@streamlayer/react 1.23.1 → 1.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/lib/cjs/Question.js +1 -1
  2. package/lib/cjs/advertisement.js +28 -223
  3. package/lib/cjs/analytics.js +1 -1
  4. package/lib/cjs/auth.js +1 -1
  5. package/lib/cjs/bet-pack.js +1 -1
  6. package/lib/cjs/feature.js +1 -1
  7. package/lib/cjs/gamification-feature.js +1 -1
  8. package/lib/cjs/gamification-feature2.js +1 -1
  9. package/lib/cjs/hooks-WfHlJH12.js +1 -1
  10. package/lib/cjs/index-eShKGO10.js +1 -5
  11. package/lib/cjs/index.js +1 -1
  12. package/lib/cjs/index10.js +1 -1
  13. package/lib/cjs/index11.js +3 -4
  14. package/lib/cjs/index12.js +1 -1
  15. package/lib/cjs/index13.js +3 -1
  16. package/lib/cjs/index14.js +1 -1
  17. package/lib/cjs/index15.js +1 -1
  18. package/lib/cjs/index16.js +3 -5
  19. package/lib/cjs/index2.js +1 -1
  20. package/lib/cjs/index3.js +1 -1
  21. package/lib/cjs/index4.js +3 -5
  22. package/lib/cjs/index5.js +1 -1
  23. package/lib/cjs/index6.js +1 -1
  24. package/lib/cjs/index7.js +1 -1
  25. package/lib/cjs/index8.js +1 -1
  26. package/lib/cjs/index9.js +1 -1
  27. package/lib/cjs/insight.js +1 -1
  28. package/lib/cjs/masters.js +1 -1
  29. package/lib/cjs/masters2.js +1 -13
  30. package/lib/cjs/notification.js +1 -1
  31. package/lib/cjs/pause-ad.js +1 -1
  32. package/lib/cjs/points.js +1 -1
  33. package/lib/cjs/polymarket.js +5 -15
  34. package/lib/cjs/sl-types.js +1 -15
  35. package/lib/cjs/storage.js +1 -1
  36. package/lib/cjs/style.css +1 -0
  37. package/lib/cjs/theme.js +1 -17
  38. package/lib/cjs/useStreamLayerApp.js +1 -1
  39. package/lib/cjs/useStreamLayerApp2.js +3 -17
  40. package/lib/cjs/utils.js +1 -47
  41. package/lib/classic/cjs/Question.js +1 -1
  42. package/lib/classic/cjs/advertisement.js +28 -223
  43. package/lib/classic/cjs/analytics.js +1 -1
  44. package/lib/classic/cjs/auth.js +1 -1
  45. package/lib/classic/cjs/bet-pack.js +3 -5
  46. package/lib/classic/cjs/feature.js +1 -1
  47. package/lib/classic/cjs/gamification-feature.js +1 -1
  48. package/lib/classic/cjs/hooks-WfHlJH12.js +1 -1
  49. package/lib/classic/cjs/index-eShKGO10.js +1 -5
  50. package/lib/classic/cjs/index.js +1 -1
  51. package/lib/classic/cjs/index10.js +1 -1
  52. package/lib/classic/cjs/index11.js +1 -1
  53. package/lib/classic/cjs/index12.js +1 -1
  54. package/lib/classic/cjs/index13.js +3 -4
  55. package/lib/classic/cjs/index2.js +3 -5
  56. package/lib/classic/cjs/index3.js +1 -1
  57. package/lib/classic/cjs/index4.js +1 -1
  58. package/lib/classic/cjs/index5.js +1 -1
  59. package/lib/classic/cjs/index6.js +1 -1
  60. package/lib/classic/cjs/index7.js +1 -1
  61. package/lib/classic/cjs/index8.js +1 -1
  62. package/lib/classic/cjs/index9.js +3 -1
  63. package/lib/classic/cjs/insight.js +1 -1
  64. package/lib/classic/cjs/notification.js +1 -1
  65. package/lib/classic/cjs/notification2.js +1 -1
  66. package/lib/classic/cjs/pause-ad.js +1 -1
  67. package/lib/classic/cjs/points.js +1 -1
  68. package/lib/classic/cjs/polymarket.js +5 -15
  69. package/lib/classic/cjs/sl-types.js +1 -15
  70. package/lib/classic/cjs/style.css +1 -0
  71. package/lib/classic/cjs/useStreamLayerApp.js +1 -1
  72. package/lib/classic/cjs/useStreamLayerApp2.js +3 -17
  73. package/lib/classic/cjs/utils.js +1 -47
  74. package/lib/classic/es/Question.js +277 -264
  75. package/lib/classic/es/advertisement.js +34990 -18881
  76. package/lib/classic/es/analytics.js +58 -56
  77. package/lib/classic/es/auth.js +14 -8
  78. package/lib/classic/es/bet-pack.js +2448 -2419
  79. package/lib/classic/es/feature.js +93 -48
  80. package/lib/classic/es/gamification-feature.js +2 -2
  81. package/lib/classic/es/hooks-WfHlJH12.js +78 -78
  82. package/lib/classic/es/index-eShKGO10.js +948 -948
  83. package/lib/classic/es/index.js +13 -13
  84. package/lib/classic/es/index10.js +68 -67
  85. package/lib/classic/es/index11.js +2903 -2159
  86. package/lib/classic/es/index12.js +124 -119
  87. package/lib/classic/es/index13.js +581 -566
  88. package/lib/classic/es/index2.js +2098 -1763
  89. package/lib/classic/es/index3.js +11 -11
  90. package/lib/classic/es/index4.js +127 -127
  91. package/lib/classic/es/index5.js +3 -4
  92. package/lib/classic/es/index6.js +8 -3
  93. package/lib/classic/es/index7.js +6 -5
  94. package/lib/classic/es/index8.js +8 -7
  95. package/lib/classic/es/index9.js +225 -223
  96. package/lib/classic/es/insight.js +58 -53
  97. package/lib/classic/es/notification.js +3 -3
  98. package/lib/classic/es/notification2.js +764 -722
  99. package/lib/classic/es/pause-ad.js +190 -167
  100. package/lib/classic/es/points.js +55 -48
  101. package/lib/classic/es/polymarket.js +4209 -4031
  102. package/lib/classic/es/sl-types.js +193 -125
  103. package/lib/classic/es/useStreamLayerApp.js +2 -2
  104. package/lib/classic/es/useStreamLayerApp2.js +9714 -7603
  105. package/lib/classic/es/utils.js +28 -28
  106. package/lib/classic/index.d.ts +1 -0
  107. package/lib/classic/style.css +1 -0
  108. package/lib/dist/cjs/gamification-feature.js +1 -1
  109. package/lib/dist/cjs/index-eShKGO10.js +1 -5
  110. package/lib/dist/cjs/index.js +1 -1
  111. package/lib/dist/cjs/masters.js +3 -77
  112. package/lib/dist/es/gamification-feature.js +2 -2
  113. package/lib/dist/es/index-eShKGO10.js +948 -948
  114. package/lib/dist/es/index.js +7 -8
  115. package/lib/dist/es/masters.js +18197 -14750
  116. package/lib/dist/index.d.ts +12 -2
  117. package/lib/dist/style.css +1 -1
  118. package/lib/es/Question.js +108 -106
  119. package/lib/es/advertisement.js +34990 -18881
  120. package/lib/es/analytics.js +58 -56
  121. package/lib/es/auth.js +14 -8
  122. package/lib/es/bet-pack.js +29 -17
  123. package/lib/es/feature.js +93 -48
  124. package/lib/es/gamification-feature.js +2 -2
  125. package/lib/es/gamification-feature2.js +2 -2
  126. package/lib/es/hooks-WfHlJH12.js +78 -78
  127. package/lib/es/index-eShKGO10.js +948 -948
  128. package/lib/es/index.js +14 -13
  129. package/lib/es/index10.js +176 -166
  130. package/lib/es/index11.js +581 -566
  131. package/lib/es/index12.js +124 -119
  132. package/lib/es/index13.js +225 -223
  133. package/lib/es/index14.js +68 -67
  134. package/lib/es/index15.js +2903 -2159
  135. package/lib/es/index16.js +1005 -806
  136. package/lib/es/index2.js +1117 -984
  137. package/lib/es/index3.js +3 -4
  138. package/lib/es/index4.js +2424 -2407
  139. package/lib/es/index5.js +11 -11
  140. package/lib/es/index6.js +127 -127
  141. package/lib/es/index7.js +8 -3
  142. package/lib/es/index8.js +5 -5
  143. package/lib/es/index9.js +8 -7
  144. package/lib/es/insight.js +58 -53
  145. package/lib/es/masters.js +6 -5
  146. package/lib/es/masters2.js +696 -559
  147. package/lib/es/notification.js +696 -655
  148. package/lib/es/pause-ad.js +190 -167
  149. package/lib/es/points.js +56 -49
  150. package/lib/es/polymarket.js +4209 -4031
  151. package/lib/es/sl-types.js +200 -132
  152. package/lib/es/storage.js +75 -74
  153. package/lib/es/theme.js +177 -31
  154. package/lib/es/useStreamLayerApp.js +2 -2
  155. package/lib/es/useStreamLayerApp2.js +9714 -7603
  156. package/lib/es/utils.js +28 -28
  157. package/lib/index.d.ts +1 -0
  158. package/lib/style.css +1 -1
  159. package/package.json +23 -20
@@ -1,223 +1,28 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("react/jsx-runtime"),by=require("./index7.js"),J=require("./sl-types.js"),El=require("./analytics.js"),Se=require("react"),ei=require("./index5.js"),oe=require("./useStreamLayerApp2.js"),Aa=require("./index10.js"),xy=require("./index4.js"),Jn=require("./index9.js"),ci=require("./index11.js"),Cs=require("uuid"),Sy=require("./utils.js"),Jt=require("./hooks-WfHlJH12.js");function Ke(){return Ke=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Ke.apply(null,arguments)}const Ey=J.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),Cy="a1rlj479",Ay="s35f1di",wy="sj4471g",Dy="b12050d8",Iy="b1d5ybek",ky=i=>i==="left"||i==="right"?Ay:Dy,Py=i=>i==="left"||i==="right"?wy:Iy,Ly=i=>i==="left"?"avdxyl3":i==="right"?"a1bisd08":i==="top"?"a1u9y2aj":"a1qqaks",Cl=({children:i,style:e,className:t,enabled:r=!0,hiding:s,direction:n="left",onAnimationEnd:a})=>G.jsx(Ey,{style:e,className:J.cx_default(t,Cy,Ly(n),r&&!s&&ky(n),r&&s&&Py(n)),onAnimationEnd:a,children:i}),Ry=J.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),Oy=J.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),Ny=()=>Ry,By=J.styled_default(Ny())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),_h=({promotion:i,promotionId:e,hiding:t,isEventFired:r,fireEvent:s,direction:n="bottom"})=>{const a=(i==null?void 0:i.adUnit)===oe.AdUnit.STANDART,l=a?i.banner:i.additionalBanner;if(Se.useEffect(()=>{l!=null&&l.imageUrl&&i.type&&e&&(r!=null&&r("banner-showed")||(ei.eventBus.emit("advertisement",{action:"bannerShown",payload:{id:e,type:i.type}}),s==null||s("banner-showed")))},[l==null?void 0:l.imageUrl,s,r,i.type,e]),!(l!=null&&l.imageUrl))return null;let u=l==null?void 0:l.url;return u&&u.indexOf("http")!==0&&(u=`https://${u}`),G.jsx(Cl,{direction:n,hiding:t,children:G.jsx(Oy,{className:"BannerContainer","data-is-ad":a,children:G.jsx(By,{as:u?"a":"span",className:"BannerLink",href:u,style:{backgroundImage:`url(${l.imageUrl})`,cursor:u?"pointer":"default"},"data-promo-id":e,"data-promo-type":i.type,"data-a":"banner",target:"_blank","data-is-ad":a})})})},My=({cardId:i,promotion:e,direction:t="bottom"})=>G.jsx(_h,{promotion:e,promotionId:i,direction:t,hiding:!1}),Uy=J.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),Fy=J.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),$y=J.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),jy=J.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),Cr=J.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),Vy=()=>Cr,qy=J.styled_default(Vy())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),yc=J.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),Hy=J.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),zy=J.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),Wy=J.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),Gy=J.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),Th=J.styled_default("button")({name:"TVButton",class:"tkkfuqy",propsAsIs:!1}),Ky=()=>Th,Xy=J.styled_default(Ky())({name:"DismissButton",class:"dh9vato",propsAsIs:!0}),Yy=()=>Th,vh=J.styled_default(Yy())({name:"OpenButton",class:"oeah8gv",propsAsIs:!0}),Qy={[oe.NotificationPromotionImagePosition.UNSET]:Cr,[oe.NotificationPromotionImagePosition.FIT]:Cr,[oe.NotificationPromotionImagePosition.CENTERED]:Cr,[oe.NotificationPromotionImagePosition.SOLID]:Cr,[oe.NotificationPromotionImagePosition.BOTTOM]:Cr,[oe.NotificationPromotionImagePosition.MIDDLE]:qy},Jy=({src:i,imagePosition:e})=>{const t=Qy[e];return G.jsx(t,{children:G.jsx("img",{src:i,alt:""})})},Zy=Aa.O(Xy),e_=Aa.O(vh),t_=({notification:i,open:e,close:t,webos:r})=>{if(!i||!i.promotion||i.enabled!==oe.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:s,body:n,image:a,promotion:l}=i,{sponsorLogo:u,sponsorLogoMode:f,imagePosition:p,ctaButton:T}=l;return G.jsxs(Gy,{"data-webos":r,className:"SL_Lower_Third_Notification",onClick:r?void 0:e,children:[G.jsxs(Uy,{children:[G.jsx(Jy,{src:a,imagePosition:p}),G.jsxs(Fy,{children:[s&&G.jsx($y,{children:s}),n&&G.jsx(jy,{children:n})]})]}),G.jsxs(zy,{children:[f!==oe.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&G.jsxs(G.Fragment,{children:[G.jsx(Hy,{children:G.jsx("img",{src:u,alt:s})}),G.jsx(Wy,{})]}),r?G.jsxs(G.Fragment,{children:[G.jsx(Zy,{webos:!0,onClick:t,children:"Dismiss"}),G.jsxs(e_,{webos:!0,autoFocus:!0,style:{color:T==null?void 0:T.textColor,backgroundColor:T==null?void 0:T.color},onClick:e,children:[(T==null?void 0:T.ctaIcon)&&(T==null?void 0:T.ctaIconMode)===oe.CtaIconMode.CTA_ICON_TRANSPARENT&&G.jsx(yc,{src:T==null?void 0:T.ctaIcon,alt:"cta-icon"}),(T==null?void 0:T.label)||"Open"]})]}):G.jsxs(vh,{name:"promo-button",style:{color:T==null?void 0:T.textColor,backgroundColor:T==null?void 0:T.color},children:[(T==null?void 0:T.ctaIcon)&&(T==null?void 0:T.ctaIconMode)===oe.CtaIconMode.CTA_ICON_TRANSPARENT&&G.jsx(yc,{src:T==null?void 0:T.ctaIcon,alt:"cta-icon"}),(T==null?void 0:T.label)||"Open"]})]})]})},i_=J.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),r_=J.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),s_=J.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),n_=J.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),a_=J.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),wa=J.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),o_=()=>wa,_c=J.styled_default(o_())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),l_=()=>wa,bh=J.styled_default(l_())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),u_=()=>bh,c_=J.styled_default(u_())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),d_=()=>wa,h_=J.styled_default(d_())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),f_=()=>wa,p_=J.styled_default(f_())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),m_=J.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),g_=()=>xy.B1,y_=J.styled_default(g_())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),__=J.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),xh=J.styled_default("button")({name:"TVButton",class:"thdqfl0",propsAsIs:!1}),T_=()=>xh,v_=J.styled_default(T_())({name:"DismissButton",class:"d11pe8bx",propsAsIs:!0}),b_=()=>xh,x_=J.styled_default(b_())({name:"OpenButton",class:"oy9k0kp",propsAsIs:!0}),S_={[oe.NotificationPromotionImagePosition.UNSET]:_c,[oe.NotificationPromotionImagePosition.FIT]:_c,[oe.NotificationPromotionImagePosition.CENTERED]:bh,[oe.NotificationPromotionImagePosition.BOTTOM]:c_,[oe.NotificationPromotionImagePosition.SOLID]:h_,[oe.NotificationPromotionImagePosition.MIDDLE]:p_},E_=({src:i,imagePosition:e})=>{const t=S_[e];return G.jsx(t,{children:G.jsx("img",{src:i,alt:""})})},C_=Aa.O(v_),A_=Aa.O(x_),w_=({notification:i,open:e,promotionId:t,hiding:r,direction:s="left",close:n,webos:a})=>{if(!i||!i.promotion||i.enabled!==oe.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(i.promotion.mode===oe.NotificationPromotionMode.LOWER_THIRD)return G.jsx(t_,{notification:i,open:e,close:n,webos:a});const{title:l,body:u,image:f,promotion:p}=i,{sponsorLogo:T,sponsorLogoMode:b,imagePosition:S,ctaButton:A}=p,v=L=>{L.stopPropagation(),n==null||n()};return G.jsx(Cl,{className:"SL_Rich_Notification",direction:s,hiding:r,children:G.jsxs(r_,{onClick:a?()=>{}:e,children:[b!==oe.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&T&&G.jsx(__,{children:G.jsx("img",{src:T,alt:l})}),G.jsxs(i_,{children:[G.jsx(E_,{src:f,imagePosition:S}),G.jsxs(s_,{children:[l&&G.jsx(n_,{children:l}),u&&G.jsx(a_,{children:u})]}),a&&G.jsx(C_,{webos:!0,onClick:v,children:"Dismiss"}),G.jsxs(A_,{webos:a,autoFocus:a,onClick:a?e:()=>{},name:"promo-button",style:{color:A==null?void 0:A.textColor,backgroundColor:A==null?void 0:A.color},children:[(A==null?void 0:A.ctaIcon)&&(A==null?void 0:A.ctaIconMode)===oe.CtaIconMode.CTA_ICON_TRANSPARENT&&G.jsx(m_,{src:A==null?void 0:A.ctaIcon,alt:"cta-icon"}),(A==null?void 0:A.label)||"Open"]}),G.jsx(y_,{name:"chevronRight"})]})]})})},D_=J.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),Sh=J.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),Eh=J.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),Ch=J.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),Ah="h10toh7",Tc=J.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),I_=J.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),wh=J.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),k_=J.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),P_="s1nmch9k",vc=J.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),L_=J.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),R_=J.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),O_=J.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),Dh=J.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),N_=J.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),Ih=J.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),kh=J.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),B_=J.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),M_="h17rwbtk",U_=J.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),bc=J.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),F_=J.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),$_=({time:i,adCount:e,adPosition:t})=>{const r=Math.floor(i/60),s=i-r*60;return r===0&&s===0&&e===t?null:G.jsxs(U_,{children:[e>1&&G.jsxs(G.Fragment,{children:[G.jsxs(bc,{children:[t," of ",e]}),G.jsx(F_,{})]}),G.jsxs(bc,{children:[r,":",s<10?`0${s}`:s]})]})},j_=J.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),V_=({whyThisAd:i})=>{const[e,t]=Se.useState(!1);return!i.iconClickThroughURLTemplate||!i.staticResource?null:G.jsxs(j_,{style:{width:i.width,height:i.height,[i.xPosition]:3,[i.yPosition]:11},href:i.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!e&&G.jsx("img",{alt:"ad choice",src:i.staticResource,onLoad:()=>t(!1),onError:()=>t(!0)}),e&&G.jsx("span",{children:"ad choice"})]})},q_=J.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),Ph=J.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),H_=()=>Ph,z_=J.styled_default(H_())({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),W_=()=>Ph,G_=J.styled_default(W_())({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),K_=J.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),X_=J.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),xc="m12n261r",Sc="m16vcml8",Ec="m1078nk6";function Al(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:i.id||null,adId:i.adId||null,sequence:i.sequence||null,apiFramework:i.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const Y_=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function Cc(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=[],s=Rh(i);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=Bh(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const n in e)e[n]=Nh(e[n]);for(const n in s){const a=s[n];typeof a=="string"&&r.push(Lh(a,e))}return r}function Lh(i,e){const t=(i=Ac(i,e)).match(/[^[\]]+(?=])/g);if(!t)return i;let r=t.filter(s=>Y_.indexOf(s)>-1);return r.length===0?i:(r=r.reduce((s,n)=>(s[n]=-1,s),{}),Ac(i,r))}function Ac(i,e){let t=i;for(const r in e){const s=e[r];t=t.replace(new RegExp("(?:\\[|%%)(".concat(r,")(?:\\]|%%)"),"g"),s)}return t}function Rh(i){return Array.isArray(i)?i.map(e=>e&&e.hasOwnProperty("url")?e.url:e):i}function wc(i){return/^(https?:\/\/|\/\/)/.test(i)}function Dc(i,e){for(let t=0;t<e.length;t++)if(Oh(e[t],i))return!0;return!1}function Oh(i,e){if(i&&e){const t=Object.getOwnPropertyNames(i),r=Object.getOwnPropertyNames(e);return t.length===r.length&&i.id===e.id&&i.url===e.url}return!1}function Nh(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function Bh(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;return i.toString().padStart(e,"0")}const De={track:function(i,e,t){Cc(i,e,t).forEach(r=>{typeof window<"u"&&window!==null&&(new Image().src=r)})},resolveURLTemplates:Cc,extractURLsFromTemplates:Rh,filterUrlTemplates:function(i){return i.reduce((e,t)=>{const r=t.url||t;return wc(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:Dc,isTemplateObjectEqual:Oh,encodeURIComponentRFC3986:Nh,replaceUrlMacros:Lh,isNumeric:function(i){return!isNaN(parseFloat(i))&&isFinite(i)},flatten:function i(e){return e.reduce((t,r)=>t.concat(Array.isArray(r)?i(r):r),[])},joinArrayOfUniqueTemplateObjs:function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const t=Array.isArray(i)?i:[],r=Array.isArray(e)?e:[];return t.concat(r).reduce((s,n)=>(Dc(n,s)||s.push(n),s),[])},isValidTimeValue:function(i){return Number.isFinite(i)&&i>=-2},addLeadingZeros:Bh,isValidUrl:wc,isBrowserEnvironment:function(){return typeof window<"u"},formatMacrosValues:function(i){return typeof i!="object"?i:JSON.stringify(i)}};function Ic(i){return["true","TRUE","True","1"].includes(i)}function Q_(i){if(i==null)return-1;if(De.isNumeric(i))return parseInt(i);const e=i.split(":");if(e.length!==3)return-1;const t=e[2].split(".");let r=parseInt(t[0]);t.length===2&&(r+=parseFloat("0.".concat(t[1])));const s=parseInt(60*e[1]),n=parseInt(60*e[0]*60);return isNaN(n)||isNaN(s)||isNaN(r)||s>3600||r>60?-1:n+s+r}const j={childByName:function(i,e){return Array.from(i.childNodes).find(t=>t.nodeName===e)},childrenByName:function(i,e){return Array.from(i.childNodes).filter(t=>t.nodeName===e)},resolveVastAdTagURI:function(i,e){if(!e)return i;if(i.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(i)}if(!i.includes("://")){const t=e.slice(0,e.lastIndexOf("/"));return"".concat(t,"/").concat(i)}return i},parseBoolean:Ic,parseNodeText:function(i){return i&&(i.textContent||i.text||"").trim()},copyNodeAttribute:function(i,e,t){const r=e.getAttribute(i);r&&t.setAttribute(i,r)},parseAttributes:function(i){return Array.from(i.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:Q_,getStandAloneAds:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(i=>!parseInt(i.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(i=>parseInt(i.sequence,10)).sort((i,e)=>i.sequence-e.sequence)},assignAttributes:function(i,e){i&&Array.from(i).forEach(t=>{let{nodeName:r,nodeValue:s}=t;if(r&&s&&e.hasOwnProperty(r)){let n=s;typeof e[r]=="boolean"&&(n=Ic(n)),e[r]=n}})},mergeWrapperAdData:function(i,e){var t;i.errorURLTemplates=e.errorURLTemplates.concat(i.errorURLTemplates),i.impressionURLTemplates=e.impressionURLTemplates.concat(i.impressionURLTemplates),i.extensions=e.extensions.concat(i.extensions),e.viewableImpression.length>0&&(i.viewableImpression=[...i.viewableImpression,...e.viewableImpression]),i.followAdditionalWrappers=e.followAdditionalWrappers,i.allowMultipleAds=e.allowMultipleAds,i.fallbackOnNoAd=e.fallbackOnNoAd;const r=(e.creatives||[]).filter(l=>l&&l.type==="companion"),s=r.reduce((l,u)=>((u.variations||[]).forEach(f=>{(f.companionClickTrackingURLTemplates||[]).forEach(p=>{De.containsTemplateObject(p,l)||l.push(p)})}),l),[]);i.creatives=r.concat(i.creatives);const n=e.videoClickTrackingURLTemplates&&e.videoClickTrackingURLTemplates.length,a=e.videoCustomClickURLTemplates&&e.videoCustomClickURLTemplates.length;if(i.creatives.forEach(l=>{if(e.trackingEvents&&e.trackingEvents[l.type])for(const u in e.trackingEvents[l.type]){const f=e.trackingEvents[l.type][u];Array.isArray(l.trackingEvents[u])||(l.trackingEvents[u]=[]),l.trackingEvents[u]=l.trackingEvents[u].concat(f)}l.type==="linear"&&(n&&(l.videoClickTrackingURLTemplates=l.videoClickTrackingURLTemplates.concat(e.videoClickTrackingURLTemplates)),a&&(l.videoCustomClickURLTemplates=l.videoCustomClickURLTemplates.concat(e.videoCustomClickURLTemplates)),!e.videoClickThroughURLTemplate||l.videoClickThroughURLTemplate!==null&&l.videoClickThroughURLTemplate!==void 0||(l.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate)),l.type==="companion"&&s.length&&(l.variations||[]).forEach(u=>{u.companionClickTrackingURLTemplates=De.joinArrayOfUniqueTemplateObjs(u.companionClickTrackingURLTemplates,s)})}),e.adVerifications&&(i.adVerifications=i.adVerifications.concat(e.adVerifications)),e.blockedAdCategories&&(i.blockedAdCategories=i.blockedAdCategories.concat(e.blockedAdCategories)),(t=e.creatives)!==null&&t!==void 0&&t.length){const l=e.creatives.filter(u=>{var f;return((f=u.icons)===null||f===void 0?void 0:f.length)&&!u.mediaFiles.length});l.length&&(i.creatives=i.creatives.concat(l))}}};function J_(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:s,adId:n,sequence:a,apiFramework:l}=Al(r);return{id:s,adId:n,sequence:a,apiFramework:l,type:"companion",required:null,variations:[]}}(e);return t.required=i.getAttribute("required")||null,t.variations=j.childrenByName(i,"Companion").map(r=>{const s=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:l.id||null,adType:"companionAd",width:l.width||0,height:l.height||0,assetWidth:l.assetWidth||null,assetHeight:l.assetHeight||null,expandedWidth:l.expandedWidth||null,expandedHeight:l.expandedHeight||null,apiFramework:l.apiFramework||null,adSlotId:l.adSlotId||null,pxratio:l.pxratio||"1",renderingMode:l.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(j.parseAttributes(r));s.htmlResources=j.childrenByName(r,"HTMLResource").reduce((l,u)=>{const f=j.parseNodeText(u);return f?l.concat(f):l},[]),s.iframeResources=j.childrenByName(r,"IFrameResource").reduce((l,u)=>{const f=j.parseNodeText(u);return f?l.concat(f):l},[]),s.staticResources=j.childrenByName(r,"StaticResource").reduce((l,u)=>{const f=j.parseNodeText(u);return f?l.concat({url:f,creativeType:u.getAttribute("creativeType")||null}):l},[]),s.altText=j.parseNodeText(j.childByName(r,"AltText"))||null;const n=j.childByName(r,"TrackingEvents");n&&j.childrenByName(n,"Tracking").forEach(l=>{const u=l.getAttribute("event"),f=j.parseNodeText(l);u&&f&&(Array.isArray(s.trackingEvents[u])||(s.trackingEvents[u]=[]),s.trackingEvents[u].push(f))}),s.companionClickTrackingURLTemplates=j.childrenByName(r,"CompanionClickTracking").map(l=>({id:l.getAttribute("id")||null,url:j.parseNodeText(l)})),s.companionClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"CompanionClickThrough"))||null;const a=j.childByName(r,"AdParameters");return a&&(s.adParameters={value:j.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),s}),t}function Z_(i,e){let t;const r=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:f,adId:p,sequence:T,apiFramework:b}=Al(u);return{id:f,adId:p,sequence:T,apiFramework:b,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(e);r.duration=j.parseDuration(j.parseNodeText(j.childByName(i,"Duration")));const s=i.getAttribute("skipoffset");if(s==null)r.skipDelay=null;else if(s.charAt(s.length-1)==="%"&&r.duration!==-1){const u=parseInt(s,10);r.skipDelay=r.duration*(u/100)}else r.skipDelay=j.parseDuration(s);const n=j.childByName(i,"VideoClicks");if(n){const u=j.childByName(n,"ClickThrough");r.videoClickThroughURLTemplate=u?{id:u.getAttribute("id")||null,url:j.parseNodeText(u)}:null,j.childrenByName(n,"ClickTracking").forEach(f=>{r.videoClickTrackingURLTemplates.push({id:f.getAttribute("id")||null,url:j.parseNodeText(f)})}),j.childrenByName(n,"CustomClick").forEach(f=>{r.videoCustomClickURLTemplates.push({id:f.getAttribute("id")||null,url:j.parseNodeText(f)})})}const a=j.childByName(i,"AdParameters");a&&(r.adParameters={value:j.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),j.childrenByName(i,"TrackingEvents").forEach(u=>{j.childrenByName(u,"Tracking").forEach(f=>{let p=f.getAttribute("event");const T=j.parseNodeText(f);if(p&&T){if(p==="progress"){if(t=f.getAttribute("offset"),!t)return;p=t.charAt(t.length-1)==="%"?"progress-".concat(t):"progress-".concat(j.parseDuration(t))}Array.isArray(r.trackingEvents[p])||(r.trackingEvents[p]=[]),r.trackingEvents[p].push(T)}})}),j.childrenByName(i,"MediaFiles").forEach(u=>{j.childrenByName(u,"MediaFile").forEach(S=>{r.mediaFiles.push(function(A){const v={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};v.id=A.getAttribute("id"),v.fileURL=j.parseNodeText(A),v.deliveryType=A.getAttribute("delivery"),v.codec=A.getAttribute("codec"),v.mimeType=A.getAttribute("type"),v.mediaType=A.getAttribute("mediaType")||"2D",v.apiFramework=A.getAttribute("apiFramework"),v.fileSize=parseInt(A.getAttribute("fileSize")||0),v.bitrate=parseInt(A.getAttribute("bitrate")||0),v.minBitrate=parseInt(A.getAttribute("minBitrate")||0),v.maxBitrate=parseInt(A.getAttribute("maxBitrate")||0),v.width=parseInt(A.getAttribute("width")||0),v.height=parseInt(A.getAttribute("height")||0);const L=A.getAttribute("scalable");L&&typeof L=="string"&&(v.scalable=j.parseBoolean(L));const P=A.getAttribute("maintainAspectRatio");return P&&typeof P=="string"&&(v.maintainAspectRatio=j.parseBoolean(P)),v}(S))});const f=j.childByName(u,"InteractiveCreativeFile");f&&(r.interactiveCreativeFile=function(S){const A=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:v.type||null,apiFramework:v.apiFramework||null,variableDuration:j.parseBoolean(v.variableDuration),fileURL:null}}(j.parseAttributes(S));return A.fileURL=j.parseNodeText(S),A}(f));const p=j.childByName(u,"ClosedCaptionFiles");p&&j.childrenByName(p,"ClosedCaptionFile").forEach(S=>{const A=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:v.type||null,language:v.language||null,fileURL:null}}(j.parseAttributes(S));A.fileURL=j.parseNodeText(S),r.closedCaptionFiles.push(A)});const T=j.childByName(u,"Mezzanine"),b=function(S,A){const v={};let L=!1;return A.forEach(P=>{S&&S.getAttribute(P)?v[P]=S.getAttribute(P):L=!0}),L?null:v}(T,["delivery","type","width","height"]);if(b){const S={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};S.id=T.getAttribute("id"),S.fileURL=j.parseNodeText(T),S.delivery=b.delivery,S.codec=T.getAttribute("codec"),S.type=b.type,S.width=parseInt(b.width,10),S.height=parseInt(b.height,10),S.fileSize=parseInt(T.getAttribute("fileSize"),10),S.mediaType=T.getAttribute("mediaType")||"2D",r.mezzanine=S}});const l=j.childByName(i,"Icons");return l&&j.childrenByName(l,"Icon").forEach(u=>{r.icons.push(function(f){const p={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null,iconClickFallbackImages:[],altText:null,hoverText:null};p.program=f.getAttribute("program"),p.height=parseInt(f.getAttribute("height")||0),p.width=parseInt(f.getAttribute("width")||0),p.xPosition=function(b){return["left","right"].indexOf(b)!==-1?b:parseInt(b||0)}(f.getAttribute("xPosition")),p.yPosition=function(b){return["top","bottom"].indexOf(b)!==-1?b:parseInt(b||0)}(f.getAttribute("yPosition")),p.apiFramework=f.getAttribute("apiFramework"),p.pxratio=f.getAttribute("pxratio")||"1",p.offset=j.parseDuration(f.getAttribute("offset")),p.duration=j.parseDuration(f.getAttribute("duration")),p.altText=f.getAttribute("altText"),p.hoverText=f.getAttribute("hoverText"),j.childrenByName(f,"HTMLResource").forEach(b=>{p.type=b.getAttribute("creativeType")||"text/html",p.htmlResource=j.parseNodeText(b)}),j.childrenByName(f,"IFrameResource").forEach(b=>{p.type=b.getAttribute("creativeType")||0,p.iframeResource=j.parseNodeText(b)}),j.childrenByName(f,"StaticResource").forEach(b=>{p.type=b.getAttribute("creativeType")||0,p.staticResource=j.parseNodeText(b)});const T=j.childByName(f,"IconClicks");if(T){p.iconClickThroughURLTemplate=j.parseNodeText(j.childByName(T,"IconClickThrough")),j.childrenByName(T,"IconClickTracking").forEach(S=>{p.iconClickTrackingURLTemplates.push({id:S.getAttribute("id")||null,url:j.parseNodeText(S)})});const b=j.childByName(T,"IconClickFallbackImages");b&&j.childrenByName(b,"IconClickFallbackImage").forEach(S=>{p.iconClickFallbackImages.push({url:j.parseNodeText(S)||null,width:S.getAttribute("width")||null,height:S.getAttribute("height")||null})})}return p.iconViewTrackingURLTemplate=j.parseNodeText(j.childByName(f,"IconViewTracking")),p}(u))}),r}function eT(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:s,adId:n,sequence:a,apiFramework:l}=Al(r);return{id:s,adId:n,sequence:a,apiFramework:l,type:"nonlinear",variations:[],trackingEvents:{}}}(e);return j.childrenByName(i,"TrackingEvents").forEach(r=>{let s,n;j.childrenByName(r,"Tracking").forEach(a=>{s=a.getAttribute("event"),n=j.parseNodeText(a),s&&n&&(Array.isArray(t.trackingEvents[s])||(t.trackingEvents[s]=[]),t.trackingEvents[s].push(n))})}),j.childrenByName(i,"NonLinear").forEach(r=>{const s={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};s.id=r.getAttribute("id")||null,s.width=r.getAttribute("width"),s.height=r.getAttribute("height"),s.expandedWidth=r.getAttribute("expandedWidth"),s.expandedHeight=r.getAttribute("expandedHeight"),s.scalable=j.parseBoolean(r.getAttribute("scalable")),s.maintainAspectRatio=j.parseBoolean(r.getAttribute("maintainAspectRatio")),s.minSuggestedDuration=j.parseDuration(r.getAttribute("minSuggestedDuration")),s.apiFramework=r.getAttribute("apiFramework"),j.childrenByName(r,"HTMLResource").forEach(a=>{s.type=a.getAttribute("creativeType")||"text/html",s.htmlResource=j.parseNodeText(a)}),j.childrenByName(r,"IFrameResource").forEach(a=>{s.type=a.getAttribute("creativeType")||0,s.iframeResource=j.parseNodeText(a)}),j.childrenByName(r,"StaticResource").forEach(a=>{s.type=a.getAttribute("creativeType")||0,s.staticResource=j.parseNodeText(a)});const n=j.childByName(r,"AdParameters");n&&(s.adParameters={value:j.parseNodeText(n),xmlEncoded:n.getAttribute("xmlEncoded")||null}),s.nonlinearClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"NonLinearClickThrough")),j.childrenByName(r,"NonLinearClickTracking").forEach(a=>{s.nonlinearClickTrackingURLTemplates.push({id:a.getAttribute("id")||null,url:j.parseNodeText(a)})}),t.variations.push(s)}),t}function kc(i){const e=[];return i.forEach(t=>{const r=Mh(t);r&&e.push(r)}),e}function Mh(i){if(i.nodeName==="#comment")return null;const e={name:null,value:null,attributes:{},children:[]},t=i.attributes,r=i.childNodes;if(e.name=i.nodeName,i.attributes){for(const n in t)if(t.hasOwnProperty(n)){const a=t[n];a.nodeName&&a.nodeValue&&(e.attributes[a.nodeName]=a.nodeValue)}}for(const n in r)if(r.hasOwnProperty(n)){const a=Mh(r[n]);a&&e.children.push(a)}if(e.children.length===0||e.children.length===1&&["#cdata-section","#text"].indexOf(e.children[0].name)>=0){const n=j.parseNodeText(i);n!==""&&(e.value=n),e.children=[]}return(s=e).value===null&&Object.keys(s.attributes).length===0&&s.children.length===0?null:e;var s}function tT(i){return i.getAttribute("AdID")||i.getAttribute("adID")||i.getAttribute("adId")||null}const Kn={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function Pc(i,e){if(!Kn[i.nodeName]||!Kn[i.nodeName].attributes)return;const t=Kn[i.nodeName].attributes.filter(r=>!i.getAttribute(r));t.length>0&&Gs({name:i.nodeName,parentName:i.parentNode.nodeName,attributes:t},e)}function Lc(i,e,t){const r=Kn[i.nodeName],s=!t&&i.nodeName!=="Wrapper";if(!(!r||s)){if(r.subElements){const n=r.subElements.filter(a=>!j.childByName(i,a));n.length>0&&Gs({name:i.nodeName,parentName:i.parentNode.nodeName,subElements:n},e)}!t||!r.oneOfinLineResources||r.oneOfinLineResources.some(n=>j.childByName(i,n))||Gs({name:i.nodeName,parentName:i.parentNode.nodeName,oneOfResources:r.oneOfinLineResources},e)}}function Rc(i){return i.children&&i.children.length!==0}function Gs(i,e){let{name:t,parentName:r,attributes:s,subElements:n,oneOfResources:a}=i,l="Element '".concat(t,"'");l+=s?" missing required attribute(s) '".concat(s.join(", "),"' "):n?" missing required sub element(s) '".concat(n.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",e("VAST-warning",{message:l,parentElement:r,specVersion:4.1})}const iT={verifyRequiredValues:function i(e,t,r){if(e&&e.nodeName)if(e.nodeName==="InLine"&&(r=!0),Pc(e,t),Rc(e)){Lc(e,t,r);for(let s=0;s<e.children.length;s++)i(e.children[s],t,r)}else j.parseNodeText(e).length===0&&Gs({name:e.nodeName,parentName:e.parentNode.nodeName},t)},hasSubElements:Rc,emitMissingValueWarning:Gs,verifyRequiredAttributes:Pc,verifyRequiredSubElements:Lc};function rT(i,e){let{allowMultipleAds:t,followAdditionalWrappers:r}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=Array.from(i.childNodes).filter(n=>{const a=n.nodeName.toLowerCase();return a==="inline"||r!==!1&&a==="wrapper"});for(const n of s){if(j.copyNodeAttribute("id",i,n),j.copyNodeAttribute("sequence",i,n),j.copyNodeAttribute("adType",i,n),n.nodeName==="Wrapper")return{ad:nT(n,e),type:"WRAPPER"};if(n.nodeName==="InLine")return{ad:sT(n,e,{allowMultipleAds:t}),type:"INLINE"};const a=n.nodeName.toLowerCase();e("VAST-warning",{message:"<".concat(n.nodeName,a==="inline"?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:n})}}function sT(i,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&i.getAttribute("sequence")?null:Uh(i,e)}function Uh(i,e){let t=[];e&&iT.verifyRequiredValues(i,e);const r=Array.from(i.childNodes),s=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:n.id||null,sequence:n.sequence||null,adType:n.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(j.parseAttributes(i));return r.forEach(n=>{switch(n.nodeName){case"Error":s.errorURLTemplates.push(j.parseNodeText(n));break;case"Impression":s.impressionURLTemplates.push({id:n.getAttribute("id")||null,url:j.parseNodeText(n)});break;case"Creatives":s.creatives=function(a){const l=[];return a.forEach(u=>{const f={id:u.getAttribute("id")||null,adId:tT(u),sequence:u.getAttribute("sequence")||null,apiFramework:u.getAttribute("apiFramework")||null},p=[];let T;j.childrenByName(u,"UniversalAdId").forEach(S=>{const A={idRegistry:S.getAttribute("idRegistry")||"unknown",value:j.parseNodeText(S)};p.push(A)});const b=j.childByName(u,"CreativeExtensions");b&&(T=kc(j.childrenByName(b,"CreativeExtension")));for(const S in u.childNodes){const A=u.childNodes[S];let v;switch(A.nodeName){case"Linear":v=Z_(A,f);break;case"NonLinearAds":v=eT(A,f);break;case"CompanionAds":v=J_(A,f)}v&&(p&&(v.universalAdIds=p),T&&(v.creativeExtensions=T),l.push(v))}}),l}(j.childrenByName(n,"Creative"));break;case"Extensions":{const a=j.childrenByName(n,"Extension");s.extensions=kc(a),s.adVerifications.length||(t=function(l){let u=null,f=[];return l.some(p=>u=j.childByName(p,"AdVerifications")),u&&(f=Oc(j.childrenByName(u,"Verification"))),f}(a));break}case"AdVerifications":s.adVerifications=Oc(j.childrenByName(n,"Verification"));break;case"AdSystem":s.system={value:j.parseNodeText(n),version:n.getAttribute("version")||null};break;case"AdTitle":s.title=j.parseNodeText(n);break;case"AdServingId":s.adServingId=j.parseNodeText(n);break;case"Category":s.categories.push({authority:n.getAttribute("authority")||null,value:j.parseNodeText(n)});break;case"Expires":s.expires=parseInt(j.parseNodeText(n),10);break;case"ViewableImpression":s.viewableImpression.push(function(a){const l=(u,f)=>{const p=j.parseNodeText(f);return p&&u.push(p),u};return{id:a.getAttribute("id")||null,viewable:j.childrenByName(a,"Viewable").reduce(l,[]),notViewable:j.childrenByName(a,"NotViewable").reduce(l,[]),viewUndetermined:j.childrenByName(a,"ViewUndetermined").reduce(l,[])}}(n));break;case"Description":s.description=j.parseNodeText(n);break;case"Advertiser":s.advertiser={id:n.getAttribute("id")||null,value:j.parseNodeText(n)};break;case"Pricing":s.pricing={value:j.parseNodeText(n),model:n.getAttribute("model")||null,currency:n.getAttribute("currency")||null};break;case"Survey":s.survey={value:j.parseNodeText(n),type:n.getAttribute("type")||null};break;case"BlockedAdCategories":s.blockedAdCategories.push({authority:n.getAttribute("authority")||null,value:j.parseNodeText(n)})}}),t.length&&(s.adVerifications=s.adVerifications.concat(t)),s}function nT(i,e){const t=Uh(i,e),r=i.getAttribute("followAdditionalWrappers"),s=i.getAttribute("allowMultipleAds"),n=i.getAttribute("fallbackOnNoAd");t.followAdditionalWrappers=!r||j.parseBoolean(r),t.allowMultipleAds=!!s&&j.parseBoolean(s),t.fallbackOnNoAd=n?j.parseBoolean(n):null;let a=j.childByName(i,"VASTAdTagURI");if(a?t.nextWrapperURL=j.parseNodeText(a):(a=j.childByName(i,"VASTAdTagURL"),a&&(t.nextWrapperURL=j.parseNodeText(j.childByName(a,"URL")))),t.creatives.forEach(l=>{if(["linear","nonlinear"].includes(l.type)){if(l.trackingEvents){t.trackingEvents||(t.trackingEvents={}),t.trackingEvents[l.type]||(t.trackingEvents[l.type]={});for(const u in l.trackingEvents){const f=l.trackingEvents[u];Array.isArray(t.trackingEvents[l.type][u])||(t.trackingEvents[l.type][u]=[]),f.forEach(p=>{t.trackingEvents[l.type][u].push(p)})}}l.videoClickTrackingURLTemplates&&(Array.isArray(t.videoClickTrackingURLTemplates)||(t.videoClickTrackingURLTemplates=[]),l.videoClickTrackingURLTemplates.forEach(u=>{t.videoClickTrackingURLTemplates.push(u)})),l.videoClickThroughURLTemplate&&(t.videoClickThroughURLTemplate=l.videoClickThroughURLTemplate),l.videoCustomClickURLTemplates&&(Array.isArray(t.videoCustomClickURLTemplates)||(t.videoCustomClickURLTemplates=[]),l.videoCustomClickURLTemplates.forEach(u=>{t.videoCustomClickURLTemplates.push(u)}))}}),t.nextWrapperURL)return t}function Oc(i){const e=[];return i.forEach(t=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},s=Array.from(t.childNodes);j.assignAttributes(t.attributes,r),s.forEach(a=>{let{nodeName:l,textContent:u,attributes:f}=a;switch(l){case"JavaScriptResource":case"ExecutableResource":r.resource=u.trim(),j.assignAttributes(f,r);break;case"VerificationParameters":r.parameters=u.trim()}});const n=j.childByName(t,"TrackingEvents");n&&j.childrenByName(n,"Tracking").forEach(a=>{const l=a.getAttribute("event"),u=j.parseNodeText(a);l&&u&&(Array.isArray(r.trackingEvents[l])||(r.trackingEvents[l]=[]),r.trackingEvents[l].push(u))}),e.push(r)}),e}class Fh{constructor(){this._handlers=[]}on(e,t){if(typeof t!="function")throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(r,s,n){const a={fired:!1,wrapFn:void 0};function l(){a.fired||(r.off(s,a.wrapFn),a.fired=!0,n.bind(r)(...arguments))}return a.wrapFn=l,l}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(r=>r.event!==e||r.handler!==t),this}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];let n=!1;return this._handlers.forEach(a=>{a.event==="*"&&(n=!0,a.handler(e,...r)),a.event===e&&(n=!0,a.handler(...r))}),n}removeAllListeners(e){return e?(this._handlers=this._handlers.filter(t=>t.event!==e),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter(t=>t.event===e).length}listeners(e){return this._handlers.reduce((t,r)=>(r.event===e&&t.push(r.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}}let Nc=0,Go=0;const $h=(i,e)=>{!i||!e||i<=0||e<=0||(Go=(Go*Nc+8*i/e)/++Nc)},aT={ERRORCODE:900,extensions:[]},Bc="VAST response version not supported";class oT extends Fh{constructor(){let{fetcher:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null,this.keepFailedAdPod=!1}trackVastError(e,t){for(var r=arguments.length,s=new Array(r>2?r-2:0),n=2;n<r;n++)s[n-2]=arguments[n];this.emit("VAST-error",Object.assign({},aT,t,...s)),De.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return Go}initParsingStatus(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.keepFailedAdPod=e.keepFailedAdPod||!1,this.rootURL="",this.resetParsingStatus(),$h(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(this.remainingAds.length===0)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then(r=>this.buildVASTResponse(r))}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(r=>this.buildVASTResponse(r))}buildVASTResponse(e){const t=function(r){let{ads:s,errorURLTemplates:n,version:a}=r;return{ads:s||[],errorURLTemplates:n||[],version:a||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:s=null,wrapperDepth:n=0,allowMultipleAds:a,followAdditionalWrappers:l}=t;if(!e||!e.documentElement||e.documentElement.nodeName!=="VAST"){var u;this.emit("VAST-ad-parsed",{type:"ERROR",url:s,wrapperDepth:n});const b=(e==null||(u=e.documentElement)===null||u===void 0?void 0:u.nodeName)==="VideoAdServingTemplate";throw new Error(b?Bc:"Invalid VAST XMLDocument")}const f=[],p=e.documentElement.childNodes,T=e.documentElement.getAttribute("version");r&&T&&(this.vastVersion=T);for(const b in p){const S=p[b];if(S.nodeName==="Error"){const A=j.parseNodeText(S);r?this.rootErrorURLTemplates.push(A):this.errorURLTemplates.push(A)}else if(S.nodeName==="Ad"){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(a===!1&&f.length>1)break;const A=rT(S,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:l});A.ad?(f.push(A.ad),this.emit("VAST-ad-parsed",{type:A.type,url:s,wrapperDepth:n,adIndex:f.length-1,vastVersion:T})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return f}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:s=null,previousUrl:n=null,wrapperDepth:a=0,isRootVAST:l=!1,followAdditionalWrappers:u,allowMultipleAds:f}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&l&&(f=!0);try{p=this.parseVastXml(e,{isRootVAST:l,url:t,wrapperDepth:a,allowMultipleAds:f,followAdditionalWrappers:u})}catch(T){return Promise.reject(T)}if(p.length===1&&s!=null&&(p[0].sequence=s),r===!1){const T=j.getSortedAdPods(p),b=j.getStandAloneAds(p);T.length?p=T:b.length&&(p=[b.shift()]),this.remainingAds=b}return this.resolveAds(p,{wrapperDepth:a,previousUrl:n,url:t})}resolveAds(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:s}=arguments.length>1?arguments[1]:void 0;const n=[];return r=s,e.forEach(a=>{const l=this.resolveWrappers(a,t,r);n.push(l)}),Promise.all(n).then(a=>De.flatten(a))}resolveWrappers(e,t,r){const s={...e};return new Promise(n=>{var a;if(t++,!s.nextWrapperURL)return delete s.nextWrapperURL,n(s);if(!this.fetcher)return s.VASTAdTagURI=s.nextWrapperURL,delete s.nextWrapperURL,n(s);if(t>=this.maxWrapperDepth)return s.errorCode=302,delete s.nextWrapperURL,n(s);s.nextWrapperURL=j.resolveVastAdTagURI(s.nextWrapperURL,r);const l=(a=this.parsingOptions.allowMultipleAds)!==null&&a!==void 0?a:s.allowMultipleAds,u=s.sequence;this.fetcher.fetchVAST({url:s.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(f=>this.parse(f,{url:s.nextWrapperURL,previousUrl:r,wrapperSequence:u,wrapperDepth:t,followAdditionalWrappers:s.followAdditionalWrappers,allowMultipleAds:l}).then(p=>{if(delete s.nextWrapperURL,p.length===0)return s.creatives=[],n(s);p.forEach(T=>{T&&j.mergeWrapperAdData(T,s)}),n(p)})).catch(f=>{s.errorCode=f.message===Bc?102:301,s.errorMessage=f.message,n(s)})})}completeWrapperResolving(e){if(e.ads.length===0)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const r=e.ads[t],s=!r.creatives.some(n=>{var a,l;return((a=n.mediaFiles)===null||a===void 0?void 0:a.length)>0||((l=n.variations)===null||l===void 0?void 0:l.length)>0});!r.errorCode&&!s||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),this.keepFailedAdPod&&r.sequence?r.hasFailed=!0:e.ads.splice(t,1))}}}let gi=null;const lT={data:{},length:0,getItem(i){return this.data[i]},setItem(i,e){this.data[i]=e,this.length=Object.keys(this.data).length},removeItem(i){delete this.data[i],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class uT{constructor(){this.storage=this.initStorage()}initStorage(){if(gi)return gi;try{gi=typeof window<"u"&&window!==null?window.localStorage||window.sessionStorage:null}catch{gi=null}return gi&&!this.isStorageDisabled(gi)||(gi=lT,gi.clear()),gi}isStorageDisabled(e){const t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch{return!0}return e.removeItem(t),!1}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const Ko=12e4,cT={get:async function(i,e){try{const t=new AbortController,r=setTimeout(()=>{throw t.abort(),new Error("URLHandler: Request timed out after ".concat(e.timeout||Ko," ms (408)"))},e.timeout||Ko),s=await fetch(i,{...e,signal:t.signal,credentials:e.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(r)}),n=function(a){return De.isBrowserEnvironment()&&window.location.protocol==="https:"&&a.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":a.status===200&&a.ok?null:"URLHandler: ".concat(a.statusText," (").concat(a.status,")")}(s);return n?{error:new Error(n),statusCode:s.status}:async function(a){const l=await a.text();let u;return u=De.isBrowserEnvironment()?new DOMParser:new(await Promise.resolve().then(()=>mb)).DOMParser,{xml:u.parseFromString(l,"text/xml"),details:{byteLength:l.length,statusCode:a.status,rawXml:l}}}(s)}catch(t){return{error:t,statusCode:t.name==="AbortError"?408:null}}}};let dT=class{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||cT,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||Ko,withCredentials:!!e.withCredentials}}addURLTemplateFilter(e){typeof e=="function"&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:r,maxWrapperDepth:s,emitter:n,wrapperDepth:a=0,previousUrl:l=null,wrapperAd:u=null}=e;const f=Date.now();this.URLTemplateFilters.forEach(b=>{r=b(r)}),n("VAST-resolving",{url:r,previousUrl:l,wrapperDepth:a,maxWrapperDepth:s,timeout:this.fetchingOptions.timeout,wrapperAd:u});const p=await this.urlHandler.get(r,this.fetchingOptions),T=Math.round(Date.now()-f);if(n("VAST-resolved",{url:r,previousUrl:l,wrapperDepth:a,error:(p==null?void 0:p.error)||null,duration:T,statusCode:(p==null?void 0:p.statusCode)||null,...p==null?void 0:p.details}),$h(p==null||(t=p.details)===null||t===void 0?void 0:t.byteLength,T),p.error)throw new Error(p.error);return p.xml}},hT=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new uT;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new dT,this.vastParser=new oT({fetcher:this.fetcher}),this.storage=r,this.lastSuccessfulAd===void 0&&(this.lastSuccessfulAd=0),this.totalCalls===void 0&&(this.totalCalls=0),this.totalCallsTimeout===void 0&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<r?(this.totalCalls=1,this.totalCallsTimeout=r+36e5):this.totalCalls++,new Promise((s,n)=>{if(this.cappingFreeLunch>=this.totalCalls)return n(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=r-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return n(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then(l=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(l,t).then(u=>{const f=this.vastParser.buildVASTResponse(u);s(f)}))).catch(l=>n(l))})}};class fT extends Fh{constructor(e,t,r){var s;let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=a,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const l in this.creative.trackingEvents){const u=this.creative.trackingEvents[l];this.trackingEvents[l]=u.slice(0)}this.viewableImpressionTrackers=((s=this.ad.viewableImpression)===null||s===void 0?void 0:s.reduce((l,u)=>(l.notViewable.push(...u.notViewable),l.viewUndetermined.push(...u.viewUndetermined),l.viewable.push(...u.viewable),l),{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(this.viewableImpressionTrackers).forEach(l=>{let[u,f]=l;f.length&&(this.trackingEvents[u]=f)}),function(l){return l.type==="linear"}(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}this.variation.adType==="nonLinearAd"?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return e.adType==="companionAd"}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){De.isValidTimeValue(e)?(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(!De.isValidTimeValue(e)||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(De.formatMacrosValues(t))});const s=this.skipDelay||-1;if(s===-1||this.skippable||(s>e?this.emit("skip-countdown",s-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const n=Math.round(e/this.assetDuration*100),a=[];if(e>0){a.push("start");for(let l=this.lastPercentage;l<n;l++)a.push("progress-".concat(l+1,"%"));a.push("progress-".concat(e));for(const l in this.quartiles)this.isQuartileReached(l,this.quartiles[l],e)&&(a.push(l),this._alreadyTriggeredQuartiles[l]=!0);this.lastPercentage=n}a.forEach(l=>{this.track(l,{macros:t,once:r})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,r){let s=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(s=!0),s}setMuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(De.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(De.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(De.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(De.formatMacrosValues(t))})}setSkipDelay(e){De.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"?this.track("viewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"?this.track("notViewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"?this.track("viewUndetermined",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"&&typeof t=="boolean"?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(De.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="string"&&typeof t=="boolean"?(this.error({ERRORCODE:e},t),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead")):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(De.formatMacrosValues(t))});if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");const r=this.ad.adVerifications.find(n=>n.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const s=r.trackingEvents;if(s&&s.verificationNotExecuted){const n=s.verificationNotExecuted;this.trackURLs(n,t),this.emit("verificationNotExecuted",{trackingURLTemplates:n})}}overlayViewDuration(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="string"&&typeof t=="object"?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(De.formatMacrosValues(t))})}close(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e!==null&&typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(De.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,s={...t};if(r){this.progress&&(s.ADPLAYHEAD=this.progressFormatted());const n=De.resolveURLTemplates([r],s)[0];this.emit("clickthrough",n)}}trackProgressEvents(e,t,r){const s=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(n=>{let[a]=n;return a.startsWith("progress-")}).map(n=>{let[a,l]=n;return{name:a,time:parseFloat(a.split("-")[1]),urls:l}}).filter(n=>{let{time:a}=n;return a<=s&&a>this.progress}).forEach(n=>{let{name:a,urls:l}=n;!r&&this.trackedProgressEvents.includes(a)||(this.emit(a,{trackingURLTemplates:l}),this.trackURLs(l,t),r?delete this.trackingEvents[a]:this.trackedProgressEvents.push(a))})}track(e){let{macros:t={},once:r=!1}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof t!="object")return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});e==="closeLinear"&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,r);const s=this.trackingEvents[e],n=this.emitAlwaysEvents.indexOf(e)>-1;s?(this.emit(e,{trackingURLTemplates:s}),this.trackURLs(s,t)):n&&this.emit(e,null),r&&(delete this.trackingEvents[e],n&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{validUrls:n,invalidUrls:a}=De.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const l={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(l.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(l.ADPLAYHEAD=this.progressFormatted())),(t=this.creative)!==null&&t!==void 0&&(t=t.universalAdIds)!==null&&t!==void 0&&t.length&&(l.UNIVERSALADID=this.creative.universalAdIds.map(u=>u.idRegistry.concat(" ",u.value)).join(",")),this.ad&&(this.ad.sequence&&(l.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(l.ADTYPE=this.ad.adType),this.ad.adServingId&&(l.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(l.ADCATEGORIES=this.ad.categories.map(u=>u.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(l.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(u=>u.value).join(","))),De.track(n,l,s)}convertToTimecode(e){if(!De.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),s=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(De.addLeadingZeros(r,2),":").concat(De.addLeadingZeros(s,2),":").concat(De.addLeadingZeros(n,2),".").concat(De.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}}var Os;typeof window<"u"?Os=window:typeof ci.commonjsGlobal<"u"?Os=ci.commonjsGlobal:typeof self<"u"?Os=self:Os={};var Da=Os;const k=ci.getDefaultExportFromCjs(Da),pT={},mT=Object.freeze(Object.defineProperty({__proto__:null,default:pT},Symbol.toStringTag,{value:"Module"})),gT=ci.getAugmentedNamespace(mT);var Mc=typeof ci.commonjsGlobal<"u"?ci.commonjsGlobal:typeof window<"u"?window:{},yT=gT,Ns;typeof document<"u"?Ns=document:(Ns=Mc["__GLOBAL_DOCUMENT_CACHE@4"],Ns||(Ns=Mc["__GLOBAL_DOCUMENT_CACHE@4"]=yT));var jh=Ns;const X=ci.getDefaultExportFromCjs(jh);var wl={exports:{}},Vh={exports:{}};(function(i){function e(){return i.exports=e=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var n in s)({}).hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},i.exports.__esModule=!0,i.exports.default=i.exports,e.apply(null,arguments)}i.exports=e,i.exports.__esModule=!0,i.exports.default=i.exports})(Vh);var _T=Vh.exports,TT=bT,vT=Object.prototype.toString;function bT(i){if(!i)return!1;var e=vT.call(i);return e==="[object Function]"||typeof i=="function"&&e!=="[object RegExp]"||typeof window<"u"&&(i===window.setTimeout||i===window.alert||i===window.confirm||i===window.prompt)}function xT(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t)return(t=t.call(i)).next.bind(t);if(Array.isArray(i)||(t=ST(i))||e){t&&(i=t);var r=0;return function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ST(i,e){if(i){if(typeof i=="string")return Uc(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Uc(i,e)}}function Uc(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}var ET=function(){function i(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var e=i.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},e.addInterceptor=function(r,s){this.typeToInterceptorsMap_.has(r)||this.typeToInterceptorsMap_.set(r,new Set);var n=this.typeToInterceptorsMap_.get(r);return n.has(s)?!1:(n.add(s),!0)},e.removeInterceptor=function(r,s){var n=this.typeToInterceptorsMap_.get(r);return n&&n.has(s)?(n.delete(s),!0):!1},e.clearInterceptorsByType=function(r){var s=this.typeToInterceptorsMap_.get(r);return s?(this.typeToInterceptorsMap_.delete(r),this.typeToInterceptorsMap_.set(r,new Set),!0):!1},e.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},e.getForType=function(r){return this.typeToInterceptorsMap_.get(r)||new Set},e.execute=function(r,s){for(var n=this.getForType(r),a=xT(n),l;!(l=a()).done;){var u=l.value;try{s=u(s)}catch{}}return s},i}(),CT=ET,AT=function(){function i(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var e=i.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},e.getMaxAttempts=function(){return this.maxAttempts_},e.setMaxAttempts=function(r){this.maxAttempts_=r},e.getDelayFactor=function(){return this.delayFactor_},e.setDelayFactor=function(r){this.delayFactor_=r},e.getFuzzFactor=function(){return this.fuzzFactor_},e.setFuzzFactor=function(r){this.fuzzFactor_=r},e.getInitialDelay=function(){return this.initialDelay_},e.setInitialDelay=function(r){this.initialDelay_=r},e.createRetry=function(r){var s=r===void 0?{}:r,n=s.maxAttempts,a=s.delayFactor,l=s.fuzzFactor,u=s.initialDelay;return new wT({maxAttempts:n||this.maxAttempts_,delayFactor:a||this.delayFactor_,fuzzFactor:l||this.fuzzFactor_,initialDelay:u||this.initialDelay_})},i}(),wT=function(){function i(t){this.maxAttempts_=t.maxAttempts,this.delayFactor_=t.delayFactor,this.fuzzFactor_=t.fuzzFactor,this.currentDelay_=t.initialDelay,this.currentAttempt_=1}var e=i.prototype;return e.moveToNextAttempt=function(){this.currentAttempt_++;var r=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+r},e.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},e.getCurrentDelay=function(){return this.currentDelay_},e.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},e.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},e.getCurrentFuzzedDelay=function(){var r=this.getCurrentMinPossibleDelay(),s=this.getCurrentMaxPossibleDelay();return r+Math.random()*(s-r)},i}(),DT=AT,IT=Da,kT=function(e,t){return t===void 0&&(t=!1),function(r,s,n){if(r){e(r);return}if(s.statusCode>=400&&s.statusCode<=599){var a=n;if(t)if(IT.TextDecoder){var l=PT(s.headers&&s.headers["content-type"]);try{a=new TextDecoder(l).decode(n)}catch{}}else a=String.fromCharCode.apply(null,new Uint8Array(n));e({cause:a});return}e(null,n)}};function PT(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(e,t){var r=t.split("="),s=r[0],n=r[1];return s.trim()==="charset"?n.trim():e},"utf-8")}var LT=kT,qh=Da,RT=_T,OT=TT,Hh=CT,NT=DT;We.httpHandler=LT;We.requestInterceptorsStorage=new Hh;We.responseInterceptorsStorage=new Hh;We.retryManager=new NT;/**
3
- * @license
4
- * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
5
- * Copyright (c) 2014 David Björklund
6
- * Available under the MIT license
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,`
13
- `).replace(/u2029/g,`
14
- `);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(p){e.reportOrThrowError(p),e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var i=this;try{if(i.buffer+=i.decoder.decode(),(i.cue||i.state==="HEADER")&&(i.buffer+=`
15
-
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(`
22
- `);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=="<"&&"&lt;"||i==">"&&"&gt;"||i=="&"&&"&amp;"||i=='"'&&"&quot;"||"&#"+i.charCodeAt()+";"}rn(xt,Ee);rn(xt,Ee.prototype);function Xs(i,e){if(e(i))return!0;if(i=i.firstChild)do if(Xs(i,e))return!0;while(i=i.nextSibling)}function sn(){this.ownerDocument=this}function Yv(i,e,t){i&&i._inc++;var r=t.namespaceURI;r===Ks.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function _f(i,e,t,r){i&&i._inc++;var s=t.namespaceURI;s===Ks.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function Nl(i,e,t){if(i&&i._inc){i._inc++;var r=e.childNodes;if(t)r[r.length++]=t;else{for(var s=e.firstChild,n=0;s;)r[n++]=s,s=s.nextSibling;r.length=n,delete r[r.length]}}}function Tf(i,e){var t=e.previousSibling,r=e.nextSibling;return t?t.nextSibling=r:i.firstChild=r,r?r.previousSibling=t:i.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Nl(i.ownerDocument,i),e}function Qv(i){return i&&(i.nodeType===Ee.DOCUMENT_NODE||i.nodeType===Ee.DOCUMENT_FRAGMENT_NODE||i.nodeType===Ee.ELEMENT_NODE)}function Jv(i){return i&&(ui(i)||Bl(i)||Si(i)||i.nodeType===Ee.DOCUMENT_FRAGMENT_NODE||i.nodeType===Ee.COMMENT_NODE||i.nodeType===Ee.PROCESSING_INSTRUCTION_NODE)}function Si(i){return i&&i.nodeType===Ee.DOCUMENT_TYPE_NODE}function ui(i){return i&&i.nodeType===Ee.ELEMENT_NODE}function Bl(i){return i&&i.nodeType===Ee.TEXT_NODE}function Jc(i,e){var t=i.childNodes||[];if(li(t,ui)||Si(e))return!1;var r=li(t,Si);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function Zc(i,e){var t=i.childNodes||[];function r(n){return ui(n)&&n!==e}if(li(t,r))return!1;var s=li(t,Si);return!(e&&s&&t.indexOf(s)>t.indexOf(e))}function Zv(i,e,t){if(!Qv(i))throw new Ge(yt,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new Ge(pf,"child not in parent");if(!Jv(e)||Si(e)&&i.nodeType!==Ee.DOCUMENT_NODE)throw new Ge(yt,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function eb(i,e,t){var r=i.childNodes||[],s=e.childNodes||[];if(e.nodeType===Ee.DOCUMENT_FRAGMENT_NODE){var n=s.filter(ui);if(n.length>1||li(s,Bl))throw new Ge(yt,"More than one element or text in fragment");if(n.length===1&&!Jc(i,t))throw new Ge(yt,"Element in fragment can not be inserted before doctype")}if(ui(e)&&!Jc(i,t))throw new Ge(yt,"Only one element can be added and only after doctype");if(Si(e)){if(li(r,Si))throw new Ge(yt,"Only one doctype is allowed");var a=li(r,ui);if(t&&r.indexOf(a)<r.indexOf(t))throw new Ge(yt,"Doctype can only be inserted before an element");if(!t&&a)throw new Ge(yt,"Doctype can not be appended since element is present")}}function vf(i,e,t){var r=i.childNodes||[],s=e.childNodes||[];if(e.nodeType===Ee.DOCUMENT_FRAGMENT_NODE){var n=s.filter(ui);if(n.length>1||li(s,Bl))throw new Ge(yt,"More than one element or text in fragment");if(n.length===1&&!Zc(i,t))throw new Ge(yt,"Element in fragment can not be inserted before doctype")}if(ui(e)&&!Zc(i,t))throw new Ge(yt,"Only one element can be added and only after doctype");if(Si(e)){if(li(r,function(u){return Si(u)&&u!==t}))throw new Ge(yt,"Only one doctype is allowed");var a=li(r,ui);if(t&&r.indexOf(a)<r.indexOf(t))throw new Ge(yt,"Doctype can only be inserted before an element")}}function ia(i,e,t,r){Zv(i,e,t),i.nodeType===Ee.DOCUMENT_NODE&&(r||eb)(i,e,t);var s=e.parentNode;if(s&&s.removeChild(e),e.nodeType===xi){var n=e.firstChild;if(n==null)return e;var a=e.lastChild}else n=a=e;var l=t?t.previousSibling:i.lastChild;n.previousSibling=l,a.nextSibling=t,l?l.nextSibling=n:i.firstChild=n,t==null?i.lastChild=a:t.previousSibling=a;do{n.parentNode=i;var u=i.ownerDocument||i;Ys(n,u)}while(n!==a&&(n=n.nextSibling));return Nl(i.ownerDocument||i,i),e.nodeType==xi&&(e.firstChild=e.lastChild=null),e}function Ys(i,e){if(i.ownerDocument!==e){if(i.ownerDocument=e,i.nodeType===Bt&&i.attributes)for(var t=0;t<i.attributes.length;t++){var r=i.attributes.item(t);r&&(r.ownerDocument=e)}for(var s=i.firstChild;s;)Ys(s,e),s=s.nextSibling}}function tb(i,e){e.parentNode&&e.parentNode.removeChild(e),e.parentNode=i,e.previousSibling=i.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:i.firstChild=e,i.lastChild=e,Nl(i.ownerDocument,i,e);var t=i.ownerDocument||i;return Ys(e,t),e}sn.prototype={nodeName:"#document",nodeType:hf,doctype:null,documentElement:null,_inc:1,insertBefore:function(i,e){if(i.nodeType==xi){for(var t=i.firstChild;t;){var r=t.nextSibling;this.insertBefore(t,e),t=r}return i}return ia(this,i,e),Ys(i,this),this.documentElement===null&&i.nodeType===Bt&&(this.documentElement=i),i},removeChild:function(i){return this.documentElement==i&&(this.documentElement=null),Tf(this,i)},replaceChild:function(i,e){ia(this,i,e,vf),Ys(i,this),e&&this.removeChild(e),ui(i)&&(this.documentElement=i)},importNode:function(i,e){return Cf(this,i,e)},getElementById:function(i){var e=null;return Xs(this.documentElement,function(t){if(t.nodeType==Bt&&t.getAttribute("id")==i)return e=t,!0}),e},getElementsByClassName:function(i){var e=Kc(i);return new $r(this,function(t){var r=[];return e.length>0&&Xs(t.documentElement,function(s){if(s!==t&&s.nodeType===Bt){var n=s.getAttribute("class");if(n){var a=i===n;if(!a){var l=Kc(n);a=e.every(Gv(l))}a&&r.push(s)}}}),r})},createElement:function(i){var e=new lr;e.ownerDocument=this,e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new Ti;var t=e.attributes=new ta;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new Ra;return i.ownerDocument=this,i.childNodes=new Ti,i},createTextNode:function(i){var e=new Ml;return e.ownerDocument=this,e.appendData(i),e},createComment:function(i){var e=new Ul;return e.ownerDocument=this,e.appendData(i),e},createCDATASection:function(i){var e=new Fl;return e.ownerDocument=this,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new jl;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){var e=new ra;return e.ownerDocument=this,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){var e=new $l;return e.ownerDocument=this,e.nodeName=i,e},createElementNS:function(i,e){var t=new lr,r=e.split(":"),s=t.attributes=new ta;return t.childNodes=new Ti,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=i,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,s._ownerElement=t,t},createAttributeNS:function(i,e){var t=new ra,r=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=i,t.specified=!0,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,t}};bt(sn,Ee);function lr(){this._nsMap={}}lr.prototype={nodeType:Bt,hasAttribute:function(i){return this.getAttributeNode(i)!=null},getAttribute:function(i){var e=this.getAttributeNode(i);return e&&e.value||""},getAttributeNode:function(i){return this.attributes.getNamedItem(i)},setAttribute:function(i,e){var t=this.ownerDocument.createAttribute(i);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(i){var e=this.getAttributeNode(i);e&&this.removeAttributeNode(e)},appendChild:function(i){return i.nodeType===xi?this.insertBefore(i,null):tb(this,i)},setAttributeNode:function(i){return this.attributes.setNamedItem(i)},setAttributeNodeNS:function(i){return this.attributes.setNamedItemNS(i)},removeAttributeNode:function(i){return this.attributes.removeNamedItem(i.nodeName)},removeAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(i,e){return this.getAttributeNodeNS(i,e)!=null},getAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);return t&&t.value||""},setAttributeNS:function(i,e,t){var r=this.ownerDocument.createAttributeNS(i,e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},getAttributeNodeNS:function(i,e){return this.attributes.getNamedItemNS(i,e)},getElementsByTagName:function(i){return new $r(this,function(e){var t=[];return Xs(e,function(r){r!==e&&r.nodeType==Bt&&(i==="*"||r.tagName==i)&&t.push(r)}),t})},getElementsByTagNameNS:function(i,e){return new $r(this,function(t){var r=[];return Xs(t,function(s){s!==t&&s.nodeType===Bt&&(i==="*"||s.namespaceURI===i)&&(e==="*"||s.localName==e)&&r.push(s)}),r})}};sn.prototype.getElementsByTagName=lr.prototype.getElementsByTagName;sn.prototype.getElementsByTagNameNS=lr.prototype.getElementsByTagNameNS;bt(lr,Ee);function ra(){}ra.prototype.nodeType=Fr;bt(ra,Ee);function nn(){}nn.prototype={data:"",substringData:function(i,e){return this.data.substring(i,i+e)},appendData:function(i){i=this.data+i,this.nodeValue=this.data=i,this.length=i.length},insertData:function(i,e){this.replaceData(i,0,e)},appendChild:function(i){throw new Error(tt[yt])},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var r=this.data.substring(0,i),s=this.data.substring(i+e);t=r+t+s,this.nodeValue=this.data=t,this.length=t.length}};bt(nn,Ee);function Ml(){}Ml.prototype={nodeName:"#text",nodeType:ea,splitText:function(i){var e=this.data,t=e.substring(i);e=e.substring(0,i),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};bt(Ml,nn);function Ul(){}Ul.prototype={nodeName:"#comment",nodeType:df};bt(Ul,nn);function Fl(){}Fl.prototype={nodeName:"#cdata-section",nodeType:lf};bt(Fl,nn);function La(){}La.prototype.nodeType=ff;bt(La,Ee);function bf(){}bf.prototype.nodeType=Xv;bt(bf,Ee);function xf(){}xf.prototype.nodeType=Kv;bt(xf,Ee);function $l(){}$l.prototype.nodeType=uf;bt($l,Ee);function Ra(){}Ra.prototype.nodeName="#document-fragment";Ra.prototype.nodeType=xi;bt(Ra,Ee);function jl(){}jl.prototype.nodeType=cf;bt(jl,Ee);function Sf(){}Sf.prototype.serializeToString=function(i,e,t){return Ef.call(i,e,t)};Ee.prototype.toString=Ef;function Ef(i,e){var t=[],r=this.nodeType==9&&this.documentElement||this,s=r.prefix,n=r.namespaceURI;if(n&&s==null){var s=r.lookupPrefix(n);if(s==null)var a=[{namespace:n,prefix:null}]}return Ar(this,t,i,e,a),t.join("")}function ed(i,e,t){var r=i.prefix||"",s=i.namespaceURI;if(!s||r==="xml"&&s===Ks.XML||s===Ks.XMLNS)return!1;for(var n=t.length;n--;){var a=t[n];if(a.prefix===r)return a.namespace!==s}return!0}function ko(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,yf),'"')}function Ar(i,e,t,r,s){if(s||(s=[]),r)if(i=r(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case Bt:var n=i.attributes,a=n.length,P=i.firstChild,l=i.tagName;t=Ks.isHTML(i.namespaceURI)||t;var u=l;if(!t&&!i.prefix&&i.namespaceURI){for(var f,p=0;p<n.length;p++)if(n.item(p).name==="xmlns"){f=n.item(p).value;break}if(!f)for(var T=s.length-1;T>=0;T--){var b=s[T];if(b.prefix===""&&b.namespace===i.namespaceURI){f=b.namespace;break}}if(f!==i.namespaceURI)for(var T=s.length-1;T>=0;T--){var b=s[T];if(b.namespace===i.namespaceURI){b.prefix&&(u=b.prefix+":"+l);break}}}e.push("<",u);for(var S=0;S<a;S++){var A=n.item(S);A.prefix=="xmlns"?s.push({prefix:A.localName,namespace:A.value}):A.nodeName=="xmlns"&&s.push({prefix:"",namespace:A.value})}for(var S=0;S<a;S++){var A=n.item(S);if(ed(A,t,s)){var v=A.prefix||"",L=A.namespaceURI;ko(e,v?"xmlns:"+v:"xmlns",L),s.push({prefix:v,namespace:L})}Ar(A,e,t,r,s)}if(l===u&&ed(i,t,s)){var v=i.prefix||"",L=i.namespaceURI;ko(e,v?"xmlns:"+v:"xmlns",L),s.push({prefix:v,namespace:L})}if(P||t&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(e.push(">"),t&&/^script$/i.test(l))for(;P;)P.data?e.push(P.data):Ar(P,e,t,r,s.slice()),P=P.nextSibling;else for(;P;)Ar(P,e,t,r,s.slice()),P=P.nextSibling;e.push("</",u,">")}else e.push("/>");return;case hf:case xi:for(var P=i.firstChild;P;)Ar(P,e,t,r,s.slice()),P=P.nextSibling;return;case Fr:return ko(e,i.name,i.value);case ea:return e.push(i.data.replace(/[<&>]/g,yf));case lf:return e.push("<![CDATA[",i.data,"]]>");case df:return e.push("<!--",i.data,"-->");case ff:var M=i.publicId,O=i.systemId;if(e.push("<!DOCTYPE ",i.name),M)e.push(" PUBLIC ",M),O&&O!="."&&e.push(" ",O),e.push(">");else if(O&&O!=".")e.push(" SYSTEM ",O,">");else{var U=i.internalSubset;U&&e.push(" [",U,"]"),e.push(">")}return;case cf:return e.push("<?",i.target," ",i.data,"?>");case uf:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function Cf(i,e,t){var r;switch(e.nodeType){case Bt:r=e.cloneNode(!1),r.ownerDocument=i;case xi:break;case Fr:t=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=i,r.parentNode=null,t)for(var s=e.firstChild;s;)r.appendChild(Cf(i,s,t)),s=s.nextSibling;return r}function Yo(i,e,t){var r=new e.constructor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var n=e[s];typeof n!="object"&&n!=r[s]&&(r[s]=n)}switch(e.childNodes&&(r.childNodes=new Ti),r.ownerDocument=i,r.nodeType){case Bt:var a=e.attributes,l=r.attributes=new ta,u=a.length;l._ownerElement=r;for(var f=0;f<u;f++)r.setAttributeNode(Yo(i,a.item(f),!0));break;case Fr:t=!0}if(t)for(var p=e.firstChild;p;)r.appendChild(Yo(i,p,t)),p=p.nextSibling;return r}function Af(i,e,t){i[e]=t}try{if(Object.defineProperty){let i=function(e){switch(e.nodeType){case Bt:case xi:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(i(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty($r.prototype,"length",{get:function(){return Ol(this),this.$$length}}),Object.defineProperty(Ee.prototype,"textContent",{get:function(){return i(this)},set:function(e){switch(this.nodeType){case Bt:case xi:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),Af=function(e,t,r){e["$$"+t]=r}}}catch{}qi.DocumentType=La;qi.DOMException=Ge;qi.DOMImplementation=gf;qi.Element=lr;qi.Node=Ee;qi.NodeList=Ti;qi.XMLSerializer=Sf;var Oa={},wf={};(function(i){var e=Ci.freeze;i.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),i.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
25
- `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),i.entityMap=i.HTML_ENTITIES})(wf);var Vl={},Qs=Ci.NAMESPACE,Qo=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,td=new RegExp("[\\-\\.0-9"+Qo.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),id=new RegExp("^"+Qo.source+td.source+"*(?::"+Qo.source+td.source+"*)?$"),ws=0,Ni=1,_r=2,Ds=3,Tr=4,vr=5,Is=6,$n=7;function jr(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,jr)}jr.prototype=new Error;jr.prototype.name=jr.name;function Df(){}Df.prototype={parse:function(i,e,t){var r=this.domBuilder;r.startDocument(),If(e,e={}),ib(i,e,t,r,this.errorHandler),r.endDocument()}};function ib(i,e,t,r,s){function n(de){if(de>65535){de-=65536;var ve=55296+(de>>10),Ve=56320+(de&1023);return String.fromCharCode(ve,Ve)}else return String.fromCharCode(de)}function a(de){var ve=de.slice(1,-1);return Object.hasOwnProperty.call(t,ve)?t[ve]:ve.charAt(0)==="#"?n(parseInt(ve.substr(1).replace("x","0x"))):(s.error("entity not found:"+de),de)}function l(de){if(de>v){var ve=i.substring(v,de).replace(/&#?\w+;/g,a);b&&u(v),r.characters(ve,0,de-v),v=de}}function u(de,ve){for(;de>=p&&(ve=T.exec(i));)f=ve.index,p=f+ve[0].length,b.lineNumber++;b.columnNumber=de-f+1}for(var f=0,p=0,T=/.*(?:\r\n?|\n)|.*$/g,b=r.locator,S=[{currentNSMap:e}],A={},v=0;;){try{var L=i.indexOf("<",v);if(L<0){if(!i.substr(v).match(/^\s*$/)){var P=r.doc,M=P.createTextNode(i.substr(v));P.appendChild(M),r.currentElement=M}return}switch(L>v&&l(L),i.charAt(L+1)){case"/":var le=i.indexOf(">",L+3),O=i.substring(L+2,le).replace(/[ \t\n\r]+$/g,""),U=S.pop();le<0?(O=i.substring(L+2).replace(/[\s<].*/,""),s.error("end tag name: "+O+" is not complete:"+U.tagName),le=L+1+O.length):O.match(/\s</)&&(O=O.replace(/[\s<].*/,""),s.error("end tag name: "+O+" maybe not complete"),le=L+1+O.length);var R=U.localNSMap,q=U.tagName==O,Y=q||U.tagName&&U.tagName.toLowerCase()==O.toLowerCase();if(Y){if(r.endElement(U.uri,U.localName,O),R)for(var K in R)Object.prototype.hasOwnProperty.call(R,K)&&r.endPrefixMapping(K);q||s.fatalError("end tag name: "+O+" is not match the current start tagName:"+U.tagName)}else S.push(U);le++;break;case"?":b&&u(L),le=ob(i,L,r);break;case"!":b&&u(L),le=ab(i,L,r,s);break;default:b&&u(L);var ie=new kf,me=S[S.length-1].currentNSMap,le=rb(i,L,ie,me,a,s),ge=ie.length;if(!ie.closed&&nb(i,le,ie.tagName,A)&&(ie.closed=!0,t.nbsp||s.warning("unclosed xml attribute")),b&&ge){for(var ee=rd(b,{}),ce=0;ce<ge;ce++){var te=ie[ce];u(te.offset),te.locator=rd(b,{})}r.locator=ee,sd(ie,r,me)&&S.push(ie),r.locator=b}else sd(ie,r,me)&&S.push(ie);Qs.isHTML(ie.uri)&&!ie.closed?le=sb(i,le,ie.tagName,a,r):le++}}catch(de){if(de instanceof jr)throw de;s.error("element parse error: "+de),le=-1}le>v?v=le:l(Math.max(L,v)+1)}}function rd(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function rb(i,e,t,r,s,n){function a(b,S,A){t.attributeNames.hasOwnProperty(b)&&n.fatalError("Attribute "+b+" redefined"),t.addValue(b,S.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),A)}for(var l,u,f=++e,p=ws;;){var T=i.charAt(f);switch(T){case"=":if(p===Ni)l=i.slice(e,f),p=Ds;else if(p===_r)p=Ds;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(p===Ds||p===Ni)if(p===Ni&&(n.warning('attribute value must after "="'),l=i.slice(e,f)),e=f+1,f=i.indexOf(T,e),f>0)u=i.slice(e,f),a(l,u,e-1),p=vr;else throw new Error("attribute value no end '"+T+"' match");else if(p==Tr)u=i.slice(e,f),a(l,u,e),n.warning('attribute "'+l+'" missed start quot('+T+")!!"),e=f+1,p=vr;else throw new Error('attribute value must after "="');break;case"/":switch(p){case ws:t.setTagName(i.slice(e,f));case vr:case Is:case $n:p=$n,t.closed=!0;case Tr:case Ni:break;case _r:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return n.error("unexpected end of input"),p==ws&&t.setTagName(i.slice(e,f)),f;case">":switch(p){case ws:t.setTagName(i.slice(e,f));case vr:case Is:case $n:break;case Tr:case Ni:u=i.slice(e,f),u.slice(-1)==="/"&&(t.closed=!0,u=u.slice(0,-1));case _r:p===_r&&(u=l),p==Tr?(n.warning('attribute "'+u+'" missed quot(")!'),a(l,u,e)):((!Qs.isHTML(r[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case Ds:throw new Error("attribute value missed!!")}return f;case"€":T=" ";default:if(T<=" ")switch(p){case ws:t.setTagName(i.slice(e,f)),p=Is;break;case Ni:l=i.slice(e,f),p=_r;break;case Tr:var u=i.slice(e,f);n.warning('attribute "'+u+'" missed quot(")!!'),a(l,u,e);case vr:p=Is;break}else switch(p){case _r:t.tagName,(!Qs.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,e),e=f,p=Ni;break;case vr:n.warning('attribute space is required"'+l+'"!!');case Is:p=Ni,e=f;break;case Ds:p=Tr,e=f;break;case $n:throw new Error("elements closed character '/' and '>' must be connected to")}}f++}}function sd(i,e,t){for(var r=i.tagName,s=null,T=i.length;T--;){var n=i[T],a=n.qName,l=n.value,b=a.indexOf(":");if(b>0)var u=n.prefix=a.slice(0,b),f=a.slice(b+1),p=u==="xmlns"&&f;else f=a,u=null,p=a==="xmlns"&&"";n.localName=f,p!==!1&&(s==null&&(s={},If(t,t={})),t[p]=s[p]=l,n.uri=Qs.XMLNS,e.startPrefixMapping(p,l))}for(var T=i.length;T--;){n=i[T];var u=n.prefix;u&&(u==="xml"&&(n.uri=Qs.XML),u!=="xmlns"&&(n.uri=t[u||""]))}var b=r.indexOf(":");b>0?(u=i.prefix=r.slice(0,b),f=i.localName=r.slice(b+1)):(u=null,f=i.localName=r);var S=i.uri=t[u||""];if(e.startElement(S,f,r,i),i.closed){if(e.endElement(S,f,r),s)for(u in s)Object.prototype.hasOwnProperty.call(s,u)&&e.endPrefixMapping(u)}else return i.currentNSMap=t,i.localNSMap=s,!0}function sb(i,e,t,r,s){if(/^(?:script|textarea)$/i.test(t)){var n=i.indexOf("</"+t+">",e),a=i.substring(e+1,n);if(/[&<]/.test(a))return/^script$/i.test(t)?(s.characters(a,0,a.length),n):(a=a.replace(/&#?\w+;/g,r),s.characters(a,0,a.length),n)}return e+1}function nb(i,e,t,r){var s=r[t];return s==null&&(s=i.lastIndexOf("</"+t+">"),s<e&&(s=i.lastIndexOf("</"+t)),r[t]=s),s<e}function If(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function ab(i,e,t,r){var s=i.charAt(e+2);switch(s){case"-":if(i.charAt(e+3)==="-"){var n=i.indexOf("-->",e+4);return n>e?(t.comment(i,e+4,n-e-4),n+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(i.substr(e+3,6)=="CDATA["){var n=i.indexOf("]]>",e+9);return t.startCDATA(),t.characters(i,e+9,n-e-9),t.endCDATA(),n+3}var a=lb(i,e),l=a.length;if(l>1&&/!doctype/i.test(a[0][0])){var u=a[1][0],f=!1,p=!1;l>3&&(/^public$/i.test(a[2][0])?(f=a[3][0],p=l>4&&a[4][0]):/^system$/i.test(a[2][0])&&(p=a[3][0]));var T=a[l-1];return t.startDTD(u,f,p),t.endDTD(),T.index+T[0].length}}return-1}function ob(i,e,t){var r=i.indexOf("?>",e);if(r){var s=i.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return s?(s[0].length,t.processingInstruction(s[1],s[2]),r+2):-1}return-1}function kf(){this.attributeNames={}}kf.prototype={setTagName:function(i){if(!id.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!id.test(i))throw new Error("invalid attribute:"+i);this.attributeNames[i]=this.length,this[this.length++]={qName:i,value:e,offset:t}},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};function lb(i,e){var t,r=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(s.lastIndex=e,s.exec(i);t=s.exec(i);)if(r.push(t),t[1])return r}Vl.XMLReader=Df;Vl.ParseError=jr;var ub=Ci,cb=qi,nd=wf,Pf=Vl,db=cb.DOMImplementation,ad=ub.NAMESPACE,hb=Pf.ParseError,fb=Pf.XMLReader;function Lf(i){return i.replace(/\r[\n\u0085]/g,`
26
- `).replace(/[\r\u0085\u2028]/g,`
27
- `)}function Rf(i){this.options=i||{locator:{}}}Rf.prototype.parseFromString=function(i,e){var t=this.options,r=new fb,s=t.domBuilder||new an,n=t.errorHandler,a=t.locator,l=t.xmlns||{},u=/\/x?html?$/.test(e),f=u?nd.HTML_ENTITIES:nd.XML_ENTITIES;a&&s.setDocumentLocator(a),r.errorHandler=pb(n,s,a),r.domBuilder=t.domBuilder||s,u&&(l[""]=ad.HTML),l.xml=l.xml||ad.XML;var p=t.normalizeLineEndings||Lf;return i&&typeof i=="string"?r.parse(p(i),l,f):r.errorHandler.error("invalid doc source"),s.doc};function pb(i,e,t){if(!i){if(e instanceof an)return e;i=e}var r={},s=i instanceof Function;t=t||{};function n(a){var l=i[a];!l&&s&&(l=i.length==2?function(u){i(a,u)}:i),r[a]=l&&function(u){l("[xmldom "+a+"] "+u+Jo(t))}||function(){}}return n("warning"),n("error"),n("fatalError"),r}function an(){this.cdata=!1}function br(i,e){e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber}an.prototype={startDocument:function(){this.doc=new db().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(i,e,t,r){var s=this.doc,n=s.createElementNS(i,t||e),a=r.length;jn(this,n),this.currentElement=n,this.locator&&br(this.locator,n);for(var l=0;l<a;l++){var i=r.getURI(l),u=r.getValue(l),t=r.getQName(l),f=s.createAttributeNS(i,t);this.locator&&br(r.getLocator(l),f),f.value=f.nodeValue=u,n.setAttributeNode(f)}},endElement:function(i,e,t){var r=this.currentElement;r.tagName,this.currentElement=r.parentNode},startPrefixMapping:function(i,e){},endPrefixMapping:function(i){},processingInstruction:function(i,e){var t=this.doc.createProcessingInstruction(i,e);this.locator&&br(this.locator,t),jn(this,t)},ignorableWhitespace:function(i,e,t){},characters:function(i,e,t){if(i=od.apply(this,arguments),i){if(this.cdata)var r=this.doc.createCDATASection(i);else var r=this.doc.createTextNode(i);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(i)&&this.doc.appendChild(r),this.locator&&br(this.locator,r)}},skippedEntity:function(i){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(i){(this.locator=i)&&(i.lineNumber=0)},comment:function(i,e,t){i=od.apply(this,arguments);var r=this.doc.createComment(i);this.locator&&br(this.locator,r),jn(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(i,e,t){var r=this.doc.implementation;if(r&&r.createDocumentType){var s=r.createDocumentType(i,e,t);this.locator&&br(this.locator,s),jn(this,s),this.doc.doctype=s}},warning:function(i){console.warn("[xmldom warning] "+i,Jo(this.locator))},error:function(i){console.error("[xmldom error] "+i,Jo(this.locator))},fatalError:function(i){throw new hb(i,this.locator)}};function Jo(i){if(i)return`
28
- @`+(i.systemId||"")+"#[line:"+i.lineNumber+",col:"+i.columnNumber+"]"}function od(i,e,t){return typeof i=="string"?i.substr(e,t):i.length>=e+t||e?new java.lang.String(i,e,t)+"":i}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(i){an.prototype[i]=function(){return null}});function jn(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}Oa.__DOMHandler=an;Oa.normalizeLineEndings=Lf;Oa.DOMParser=Rf;var Of=Oa.DOMParser;const mb=Object.freeze(Object.defineProperty({__proto__:null,DOMParser:Of},Symbol.toStringTag,{value:"Module"}));/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const ld=i=>!!i&&typeof i=="object",Ze=(...i)=>i.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(r=>{Array.isArray(e[r])&&Array.isArray(t[r])?e[r]=e[r].concat(t[r]):ld(e[r])&&ld(t[r])?e[r]=Ze(e[r],t[r]):e[r]=t[r]}),e),{}),Nf=i=>Object.keys(i).map(e=>i[e]),gb=(i,e)=>{const t=[];for(let r=i;r<e;r++)t.push(r);return t},Vr=i=>i.reduce((e,t)=>e.concat(t),[]),Bf=i=>{if(!i.length)return[];const e=[];for(let t=0;t<i.length;t++)e.push(i[t]);return e},yb=(i,e)=>i.reduce((t,r,s)=>(r[e]&&t.push(s),t),[]),_b=(i,e)=>Nf(i.reduce((t,r)=>(r.forEach(s=>{t[e(s)]=s}),t),{}));var qr={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const Js=({baseUrl:i="",source:e="",range:t="",indexRange:r=""})=>{const s={uri:e,resolvedUri:ka(i||"",e)};if(t||r){const a=(t||r).split("-");let l=k.BigInt?k.BigInt(a[0]):parseInt(a[0],10),u=k.BigInt?k.BigInt(a[1]):parseInt(a[1],10);l<Number.MAX_SAFE_INTEGER&&typeof l=="bigint"&&(l=Number(l)),u<Number.MAX_SAFE_INTEGER&&typeof u=="bigint"&&(u=Number(u));let f;typeof u=="bigint"||typeof l=="bigint"?f=k.BigInt(u)-k.BigInt(l)+k.BigInt(1):f=u-l+1,typeof f=="bigint"&&f<Number.MAX_SAFE_INTEGER&&(f=Number(f)),s.byterange={length:f,offset:l}}return s},Tb=i=>{let e;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=k.BigInt(i.offset)+k.BigInt(i.length)-k.BigInt(1):e=i.offset+i.length-1,`${i.offset}-${e}`},ud=i=>(i&&typeof i!="number"&&(i=parseInt(i,10)),isNaN(i)?null:i),vb={static(i){const{duration:e,timescale:t=1,sourceDuration:r,periodDuration:s}=i,n=ud(i.endNumber),a=e/t;return typeof n=="number"?{start:0,end:n}:typeof s=="number"?{start:0,end:s/a}:{start:0,end:r/a}},dynamic(i){const{NOW:e,clientOffset:t,availabilityStartTime:r,timescale:s=1,duration:n,periodStart:a=0,minimumUpdatePeriod:l=0,timeShiftBufferDepth:u=1/0}=i,f=ud(i.endNumber),p=(e+t)/1e3,T=r+a,S=p+l-T,A=Math.ceil(S*s/n),v=Math.floor((p-T-u)*s/n),L=Math.floor((p-T)*s/n);return{start:Math.max(0,v),end:typeof f=="number"?f:Math.min(A,L)}}},bb=i=>e=>{const{duration:t,timescale:r=1,periodStart:s,startNumber:n=1}=i;return{number:n+e,duration:t/r,timeline:s,time:e*t}},ql=i=>{const{type:e,duration:t,timescale:r=1,periodDuration:s,sourceDuration:n}=i,{start:a,end:l}=vb[e](i),u=gb(a,l).map(bb(i));if(e==="static"){const f=u.length-1,p=typeof s=="number"?s:n;u[f].duration=p-t/r*f}return u},Mf=i=>{const{baseUrl:e,initialization:t={},sourceDuration:r,indexRange:s="",periodStart:n,presentationTime:a,number:l=0,duration:u}=i;if(!e)throw new Error(qr.NO_BASE_URL);const f=Js({baseUrl:e,source:t.sourceURL,range:t.range}),p=Js({baseUrl:e,source:e,indexRange:s});if(p.map=f,u){const T=ql(i);T.length&&(p.duration=T[0].duration,p.timeline=T[0].timeline)}else r&&(p.duration=r,p.timeline=n);return p.presentationTime=a||n,p.number=l,[p]},Hl=(i,e,t)=>{const r=i.sidx.map?i.sidx.map:null,s=i.sidx.duration,n=i.timeline||0,a=i.sidx.byterange,l=a.offset+a.length,u=e.timescale,f=e.references.filter(L=>L.referenceType!==1),p=[],T=i.endList?"static":"dynamic",b=i.sidx.timeline;let S=b,A=i.mediaSequence||0,v;typeof e.firstOffset=="bigint"?v=k.BigInt(l)+e.firstOffset:v=l+e.firstOffset;for(let L=0;L<f.length;L++){const P=e.references[L],M=P.referencedSize,O=P.subsegmentDuration;let U;typeof v=="bigint"?U=v+k.BigInt(M)-k.BigInt(1):U=v+M-1;const R=`${v}-${U}`,Y=Mf({baseUrl:t,timescale:u,timeline:n,periodStart:b,presentationTime:S,number:A,duration:O,sourceDuration:s,indexRange:R,type:T})[0];r&&(Y.map=r),p.push(Y),typeof v=="bigint"?v+=k.BigInt(M):v+=M,S+=O/u,A++}return i.segments=p,i},xb=["AUDIO","SUBTITLES"],Sb=1/60,Uf=i=>_b(i,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),Eb=(i,e)=>{for(let t=0;t<i.length;t++)if(i[t].attributes.NAME===e)return i[t];return null},cd=i=>{let e=[];return jv(i,xb,(t,r,s,n)=>{e=e.concat(t.playlists||[])}),e},dd=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((t,r)=>{t.number=i.mediaSequence+r})},Cb=({oldPlaylists:i,newPlaylists:e,timelineStarts:t})=>{e.forEach(r=>{r.discontinuitySequence=t.findIndex(function({timeline:u}){return u===r.timeline});const s=Eb(i,r.attributes.NAME);if(!s||r.sidx)return;const n=r.segments[0],a=s.segments.findIndex(function(u){return Math.abs(u.presentationTime-n.presentationTime)<Sb});if(a===-1){dd({playlist:r,mediaSequence:s.mediaSequence+s.segments.length}),r.segments[0].discontinuity=!0,r.discontinuityStarts.unshift(0),(!s.segments.length&&r.timeline>s.timeline||s.segments.length&&r.timeline>s.segments[s.segments.length-1].timeline)&&r.discontinuitySequence--;return}s.segments[a].discontinuity&&!n.discontinuity&&(n.discontinuity=!0,r.discontinuityStarts.unshift(0),r.discontinuitySequence--),dd({playlist:r,mediaSequence:s.segments[a].number})})},Ab=({oldManifest:i,newManifest:e})=>{const t=i.playlists.concat(cd(i)),r=e.playlists.concat(cd(e));return e.timelineStarts=Uf([i.timelineStarts,e.timelineStarts]),Cb({oldPlaylists:t,newPlaylists:r,timelineStarts:e.timelineStarts}),e},Na=i=>i&&i.uri+"-"+Tb(i.byterange),Po=i=>{const e=i.reduce(function(r,s){return r[s.attributes.baseUrl]||(r[s.attributes.baseUrl]=[]),r[s.attributes.baseUrl].push(s),r},{});let t=[];return Object.values(e).forEach(r=>{const s=Nf(r.reduce((n,a)=>{const l=a.attributes.id+(a.attributes.lang||"");return n[l]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),n[l].segments.push(...a.segments)),a.attributes.contentProtection&&(n[l].attributes.contentProtection=a.attributes.contentProtection)):(n[l]=a,n[l].attributes.timelineStarts=[]),n[l].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),n},{}));t=t.concat(s)}),t.map(r=>(r.discontinuityStarts=yb(r.segments||[],"discontinuity"),r))},zl=(i,e)=>{const t=Na(i.sidx),r=t&&e[t]&&e[t].sidx;return r&&Hl(i,r,i.sidx.resolvedUri),i},wb=(i,e={})=>{if(!Object.keys(e).length)return i;for(const t in i)i[t]=zl(i[t],e);return i},Db=({attributes:i,segments:e,sidx:t,mediaSequence:r,discontinuitySequence:s,discontinuityStarts:n},a)=>{const l={attributes:{NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuitySequence:s,discontinuityStarts:n,timelineStarts:i.timelineStarts,mediaSequence:r,segments:e};return i.contentProtection&&(l.contentProtection=i.contentProtection),i.serviceLocation&&(l.attributes.serviceLocation=i.serviceLocation),t&&(l.sidx=t),a&&(l.attributes.AUDIO="audio",l.attributes.SUBTITLES="subs"),l},Ib=({attributes:i,segments:e,mediaSequence:t,discontinuityStarts:r,discontinuitySequence:s})=>{typeof e>"u"&&(e=[{uri:i.baseUrl,timeline:i.periodStart,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);const n={NAME:i.id,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1};i.codecs&&(n.CODECS=i.codecs);const a={attributes:n,uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,timelineStarts:i.timelineStarts,discontinuityStarts:r,discontinuitySequence:s,mediaSequence:t,segments:e};return i.serviceLocation&&(a.attributes.serviceLocation=i.serviceLocation),a},kb=(i,e={},t=!1)=>{let r;const s=i.reduce((n,a)=>{const l=a.attributes.role&&a.attributes.role.value||"",u=a.attributes.lang||"";let f=a.attributes.label||"main";if(u&&!a.attributes.label){const T=l?` (${l})`:"";f=`${a.attributes.lang}${T}`}n[f]||(n[f]={language:u,autoselect:!0,default:l==="main",playlists:[],uri:""});const p=zl(Db(a,t),e);return n[f].playlists.push(p),typeof r>"u"&&l==="main"&&(r=a,r.default=!0),n},{});if(!r){const n=Object.keys(s)[0];s[n].default=!0}return s},Pb=(i,e={})=>i.reduce((t,r)=>{const s=r.attributes.label||r.attributes.lang||"text",n=r.attributes.lang||"und";return t[s]||(t[s]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),t[s].playlists.push(zl(Ib(r),e)),t},{}),Lb=i=>i.reduce((e,t)=>(t&&t.forEach(r=>{const{channel:s,language:n}=r;e[n]={autoselect:!1,default:!1,instreamId:s,language:n},r.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=r.aspectRatio),r.hasOwnProperty("easyReader")&&(e[n].easyReader=r.easyReader),r.hasOwnProperty("3D")&&(e[n]["3D"]=r["3D"])}),e),{}),Rb=({attributes:i,segments:e,sidx:t,discontinuityStarts:r})=>{const s={attributes:{NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuityStarts:r,timelineStarts:i.timelineStarts,segments:e};return i.frameRate&&(s.attributes["FRAME-RATE"]=i.frameRate),i.contentProtection&&(s.contentProtection=i.contentProtection),i.serviceLocation&&(s.attributes.serviceLocation=i.serviceLocation),t&&(s.sidx=t),s},Ob=({attributes:i})=>i.mimeType==="video/mp4"||i.mimeType==="video/webm"||i.contentType==="video",Nb=({attributes:i})=>i.mimeType==="audio/mp4"||i.mimeType==="audio/webm"||i.contentType==="audio",Bb=({attributes:i})=>i.mimeType==="text/vtt"||i.contentType==="text",Mb=(i,e)=>{i.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:r}){return r===t.timeline}),t.segments&&t.segments.forEach((r,s)=>{r.number=s})})},hd=i=>i?Object.keys(i).reduce((e,t)=>{const r=i[t];return e.concat(r.playlists)},[]):[],Ub=({dashPlaylists:i,locations:e,contentSteering:t,sidxMapping:r={},previousManifest:s,eventStream:n})=>{if(!i.length)return{};const{sourceDuration:a,type:l,suggestedPresentationDelay:u,minimumUpdatePeriod:f}=i[0].attributes,p=Po(i.filter(Ob)).map(Rb),T=Po(i.filter(Nb)),b=Po(i.filter(Bb)),S=i.map(U=>U.attributes.captionServices).filter(Boolean),A={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:wb(p,r)};f>=0&&(A.minimumUpdatePeriod=f*1e3),e&&(A.locations=e),t&&(A.contentSteering=t),l==="dynamic"&&(A.suggestedPresentationDelay=u),n&&n.length>0&&(A.eventStream=n);const v=A.playlists.length===0,L=T.length?kb(T,r,v):null,P=b.length?Pb(b,r):null,M=p.concat(hd(L),hd(P)),O=M.map(({timelineStarts:U})=>U);return A.timelineStarts=Uf(O),Mb(M,A.timelineStarts),L&&(A.mediaGroups.AUDIO.audio=L),P&&(A.mediaGroups.SUBTITLES.subs=P),S.length&&(A.mediaGroups["CLOSED-CAPTIONS"].cc=Lb(S)),s?Ab({oldManifest:s,newManifest:A}):A},Fb=(i,e,t)=>{const{NOW:r,clientOffset:s,availabilityStartTime:n,timescale:a=1,periodStart:l=0,minimumUpdatePeriod:u=0}=i,f=(r+s)/1e3,p=n+l,b=f+u-p;return Math.ceil((b*a-e)/t)},Ff=(i,e)=>{const{type:t,minimumUpdatePeriod:r=0,media:s="",sourceDuration:n,timescale:a=1,startNumber:l=1,periodStart:u}=i,f=[];let p=-1;for(let T=0;T<e.length;T++){const b=e[T],S=b.d,A=b.r||0,v=b.t||0;p<0&&(p=v),v&&v>p&&(p=v);let L;if(A<0){const O=T+1;O===e.length?t==="dynamic"&&r>0&&s.indexOf("$Number$")>0?L=Fb(i,p,S):L=(n*a-p)/S:L=(e[O].t-p)/S}else L=A+1;const P=l+f.length+L;let M=l+f.length;for(;M<P;)f.push({number:M,duration:S/a,time:p,timeline:u}),p+=S,M++}return f},$b=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,jb=i=>(e,t,r,s)=>{if(e==="$$")return"$";if(typeof i[t]>"u")return e;const n=""+i[t];return t==="RepresentationID"||(r?s=parseInt(s,10):s=1,n.length>=s)?n:`${new Array(s-n.length+1).join("0")}${n}`},fd=(i,e)=>i.replace($b,jb(e)),Vb=(i,e)=>!i.duration&&!e?[{number:i.startNumber||1,duration:i.sourceDuration,time:0,timeline:i.periodStart}]:i.duration?ql(i):Ff(i,e),qb=(i,e)=>{const t={RepresentationID:i.id,Bandwidth:i.bandwidth||0},{initialization:r={sourceURL:"",range:""}}=i,s=Js({baseUrl:i.baseUrl,source:fd(r.sourceURL,t),range:r.range});return Vb(i,e).map(a=>{t.Number=a.number,t.Time=a.time;const l=fd(i.media||"",t),u=i.timescale||1,f=i.presentationTimeOffset||0,p=i.periodStart+(a.time-f)/u;return{uri:l,timeline:a.timeline,duration:a.duration,resolvedUri:ka(i.baseUrl||"",l),map:s,number:a.number,presentationTime:p}})},Hb=(i,e)=>{const{baseUrl:t,initialization:r={}}=i,s=Js({baseUrl:t,source:r.sourceURL,range:r.range}),n=Js({baseUrl:t,source:e.media,range:e.mediaRange});return n.map=s,n},zb=(i,e)=>{const{duration:t,segmentUrls:r=[],periodStart:s}=i;if(!t&&!e||t&&e)throw new Error(qr.SEGMENT_TIME_UNSPECIFIED);const n=r.map(u=>Hb(i,u));let a;return t&&(a=ql(i)),e&&(a=Ff(i,e)),a.map((u,f)=>{if(n[f]){const p=n[f],T=i.timescale||1,b=i.presentationTimeOffset||0;return p.timeline=u.timeline,p.duration=u.duration,p.number=u.number,p.presentationTime=s+(u.time-b)/T,p}}).filter(u=>u)},Wb=({attributes:i,segmentInfo:e})=>{let t,r;e.template?(r=qb,t=Ze(i,e.template)):e.base?(r=Mf,t=Ze(i,e.base)):e.list&&(r=zb,t=Ze(i,e.list));const s={attributes:i};if(!r)return s;const n=r(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:l=1}=t;t.duration=a/l}else n.length?t.duration=n.reduce((a,l)=>Math.max(a,Math.ceil(l.duration)),0):t.duration=0;return s.attributes=t,s.segments=n,e.base&&t.indexRange&&(s.sidx=n[0],s.segments=[]),s},Gb=i=>i.map(Wb),Fe=(i,e)=>Bf(i.childNodes).filter(({tagName:t})=>t===e),on=i=>i.textContent.trim(),Kb=i=>parseFloat(i.split("/").reduce((e,t)=>e/t)),xr=i=>{const l=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(i);if(!l)return 0;const[u,f,p,T,b,S]=l.slice(1);return parseFloat(u||0)*31536e3+parseFloat(f||0)*2592e3+parseFloat(p||0)*86400+parseFloat(T||0)*3600+parseFloat(b||0)*60+parseFloat(S||0)},Xb=i=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(i)&&(i+="Z"),Date.parse(i)),pd={mediaPresentationDuration(i){return xr(i)},availabilityStartTime(i){return Xb(i)/1e3},minimumUpdatePeriod(i){return xr(i)},suggestedPresentationDelay(i){return xr(i)},type(i){return i},timeShiftBufferDepth(i){return xr(i)},start(i){return xr(i)},width(i){return parseInt(i,10)},height(i){return parseInt(i,10)},bandwidth(i){return parseInt(i,10)},frameRate(i){return Kb(i)},startNumber(i){return parseInt(i,10)},timescale(i){return parseInt(i,10)},presentationTimeOffset(i){return parseInt(i,10)},duration(i){const e=parseInt(i,10);return isNaN(e)?xr(i):e},d(i){return parseInt(i,10)},t(i){return parseInt(i,10)},r(i){return parseInt(i,10)},presentationTime(i){return parseInt(i,10)},DEFAULT(i){return i}},Xe=i=>i&&i.attributes?Bf(i.attributes).reduce((e,t)=>{const r=pd[t.name]||pd.DEFAULT;return e[t.name]=r(t.value),e},{}):{},Yb={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Ba=(i,e)=>e.length?Vr(i.map(function(t){return e.map(function(r){const s=on(r),n=ka(t.baseUrl,s),a=Ze(Xe(r),{baseUrl:n});return n!==s&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):i,Wl=i=>{const e=Fe(i,"SegmentTemplate")[0],t=Fe(i,"SegmentList")[0],r=t&&Fe(t,"SegmentURL").map(T=>Ze({tag:"SegmentURL"},Xe(T))),s=Fe(i,"SegmentBase")[0],n=t||e,a=n&&Fe(n,"SegmentTimeline")[0],l=t||s||e,u=l&&Fe(l,"Initialization")[0],f=e&&Xe(e);f&&u?f.initialization=u&&Xe(u):f&&f.initialization&&(f.initialization={sourceURL:f.initialization});const p={template:f,segmentTimeline:a&&Fe(a,"S").map(T=>Xe(T)),list:t&&Ze(Xe(t),{segmentUrls:r,initialization:Xe(u)}),base:s&&Ze(Xe(s),{initialization:Xe(u)})};return Object.keys(p).forEach(T=>{p[T]||delete p[T]}),p},Qb=(i,e,t)=>r=>{const s=Fe(r,"BaseURL"),n=Ba(e,s),a=Ze(i,Xe(r)),l=Wl(r);return n.map(u=>({segmentInfo:Ze(t,l),attributes:Ze(a,u)}))},Jb=i=>i.reduce((e,t)=>{const r=Xe(t);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());const s=Yb[r.schemeIdUri];if(s){e[s]={attributes:r};const n=Fe(t,"cenc:pssh")[0];if(n){const a=on(n);e[s].pssh=a&&Jh(a)}}return e},{}),Zb=i=>{if(i.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(t=>{let r,s;return s=t,/^CC\d=/.test(t)?[r,s]=t.split("="):/^CC\d$/.test(t)&&(r=t),{channel:r,language:s}});if(i.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(t=>{const r={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[s,n=""]=t.split("=");r.channel=s,r.language=t,n.split(",").forEach(a=>{const[l,u]=a.split(":");l==="lang"?r.language=u:l==="er"?r.easyReader=Number(u):l==="war"?r.aspectRatio=Number(u):l==="3D"&&(r["3D"]=Number(u))})}else r.language=t;return r.channel&&(r.channel="SERVICE"+r.channel),r})},e2=i=>Vr(Fe(i.node,"EventStream").map(e=>{const t=Xe(e),r=t.schemeIdUri;return Fe(e,"Event").map(s=>{const n=Xe(s),a=n.presentationTime||0,l=t.timescale||1,u=n.duration||0,f=a/l+i.attributes.start;return{schemeIdUri:r,value:t.value,id:n.id,start:f,end:f+u/l,messageData:on(s)||n.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),t2=(i,e,t)=>r=>{const s=Xe(r),n=Ba(e,Fe(r,"BaseURL")),a=Fe(r,"Role")[0],l={role:Xe(a)};let u=Ze(i,s,l);const f=Fe(r,"Accessibility")[0],p=Zb(Xe(f));p&&(u=Ze(u,{captionServices:p}));const T=Fe(r,"Label")[0];if(T&&T.childNodes.length){const L=T.childNodes[0].nodeValue.trim();u=Ze(u,{label:L})}const b=Jb(Fe(r,"ContentProtection"));Object.keys(b).length&&(u=Ze(u,{contentProtection:b}));const S=Wl(r),A=Fe(r,"Representation"),v=Ze(t,S);return Vr(A.map(Qb(u,n,v)))},i2=(i,e)=>(t,r)=>{const s=Ba(e,Fe(t.node,"BaseURL")),n=Ze(i,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=Fe(t.node,"AdaptationSet"),l=Wl(t.node);return Vr(a.map(t2(n,s,l)))},r2=(i,e)=>{if(i.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!i.length)return null;const t=Ze({serverURL:on(i[0])},Xe(i[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},s2=({attributes:i,priorPeriodAttributes:e,mpdType:t})=>typeof i.start=="number"?i.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,n2=(i,e={})=>{const{manifestUri:t="",NOW:r=Date.now(),clientOffset:s=0,eventHandler:n=function(){}}=e,a=Fe(i,"Period");if(!a.length)throw new Error(qr.INVALID_NUMBER_OF_PERIOD);const l=Fe(i,"Location"),u=Xe(i),f=Ba([{baseUrl:t}],Fe(i,"BaseURL")),p=Fe(i,"ContentSteering");u.type=u.type||"static",u.sourceDuration=u.mediaPresentationDuration||0,u.NOW=r,u.clientOffset=s,l.length&&(u.locations=l.map(on));const T=[];return a.forEach((b,S)=>{const A=Xe(b),v=T[S-1];A.start=s2({attributes:A,priorPeriodAttributes:v?v.attributes:null,mpdType:u.type}),T.push({node:b,attributes:A})}),{locations:u.locations,contentSteeringInfo:r2(p,n),representationInfo:Vr(T.map(i2(u,f))),eventStream:Vr(T.map(e2))}},$f=i=>{if(i==="")throw new Error(qr.DASH_EMPTY_MANIFEST);const e=new Of;let t,r;try{t=e.parseFromString(i,"application/xml"),r=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error(qr.DASH_INVALID_XML);return r},a2=i=>{const e=Fe(i,"UTCTiming")[0];if(!e)return null;const t=Xe(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(qr.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},o2=(i,e={})=>{const t=n2($f(i),e),r=Gb(t.representationInfo);return Ub({dashPlaylists:r,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},l2=i=>a2($f(i));var jf=Math.pow(2,32),u2=function(i){var e=new DataView(i.buffer,i.byteOffset,i.byteLength),t;return e.getBigUint64?(t=e.getBigUint64(0),t<Number.MAX_SAFE_INTEGER?Number(t):t):e.getUint32(0)*jf+e.getUint32(4)},c2={getUint64:u2,MAX_UINT32:jf},md=c2.getUint64,d2=function(i){var e=new DataView(i.buffer,i.byteOffset,i.byteLength),t={version:i[0],flags:new Uint8Array(i.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},r=12;t.version===0?(t.earliestPresentationTime=e.getUint32(r),t.firstOffset=e.getUint32(r+4),r+=8):(t.earliestPresentationTime=md(i.subarray(r)),t.firstOffset=md(i.subarray(r+8)),r+=16),r+=2;var s=e.getUint16(r);for(r+=2;s>0;r+=12,s--)t.references.push({referenceType:(i[r]&128)>>>7,referencedSize:e.getUint32(r)&2147483647,subsegmentDuration:e.getUint32(r+4),startsWithSap:!!(i[r+8]&128),sapType:(i[r+8]&112)>>>4,sapDeltaTime:e.getUint32(r+8)&268435455});return t},h2=d2;const f2=ci.getDefaultExportFromCjs(h2);var p2=se([73,68,51]),m2=function(e,t){t===void 0&&(t=0),e=se(e);var r=e[t+5],s=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],n=(r&16)>>4;return n?s+20:s+10},Ms=function i(e,t){return t===void 0&&(t=0),e=se(e),e.length-t<10||!Ue(e,p2,{offset:t})?t:(t+=m2(e,t),i(e,t))},gd=function(e){return typeof e=="string"?sf(e):e},g2=function(e){return Array.isArray(e)?e.map(function(t){return gd(t)}):[gd(e)]},y2=function i(e,t,r){r===void 0&&(r=!1),t=g2(t),e=se(e);var s=[];if(!t.length)return s;for(var n=0;n<e.length;){var a=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,l=e.subarray(n+4,n+8);if(a===0)break;var u=n+a;if(u>e.length){if(r)break;u=e.length}var f=e.subarray(n+8,u);Ue(l,t[0])&&(t.length===1?s.push(f):s.push.apply(s,i(f,t.slice(1),r))),n=u}return s},Vn={EBML:se([26,69,223,163]),DocType:se([66,130]),Segment:se([24,83,128,103]),SegmentInfo:se([21,73,169,102]),Tracks:se([22,84,174,107]),Track:se([174]),TrackNumber:se([215]),DefaultDuration:se([35,227,131]),TrackEntry:se([174]),TrackType:se([131]),FlagDefault:se([136]),CodecID:se([134]),CodecPrivate:se([99,162]),VideoTrack:se([224]),AudioTrack:se([225]),Cluster:se([31,67,182,117]),Timestamp:se([231]),TimestampScale:se([42,215,177]),BlockGroup:se([160]),BlockDuration:se([155]),Block:se([161]),SimpleBlock:se([163])},Zo=[128,64,32,16,8,4,2,1],_2=function(e){for(var t=1,r=0;r<Zo.length&&!(e&Zo[r]);r++)t++;return t},sa=function(e,t,r,s){r===void 0&&(r=!0),s===void 0&&(s=!1);var n=_2(e[t]),a=e.subarray(t,t+n);return r&&(a=Array.prototype.slice.call(e,t,t+n),a[0]^=Zo[n-1]),{length:n,value:Uv(a,{signed:s}),bytes:a}},yd=function i(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return i(t)}):typeof e=="number"?Fv(e):e},T2=function(e){return Array.isArray(e)?e.map(function(t){return yd(t)}):[yd(e)]},v2=function i(e,t,r){if(r>=t.length)return t.length;var s=sa(t,r,!1);if(Ue(e.bytes,s.bytes))return r;var n=sa(t,r+s.length);return i(e,t,r+n.length+n.value+s.length)},_d=function i(e,t){t=T2(t),e=se(e);var r=[];if(!t.length)return r;for(var s=0;s<e.length;){var n=sa(e,s,!1),a=sa(e,s+n.length),l=s+n.length+a.length;a.value===127&&(a.value=v2(n,e,l),a.value!==e.length&&(a.value-=l));var u=l+a.value>e.length?e.length:l+a.value,f=e.subarray(l,u);Ue(t[0],n.bytes)&&(t.length===1?r.push(f):r=r.concat(i(f,t.slice(1))));var p=n.length+a.length+f.length;s+=p}return r},b2=se([0,0,0,1]),x2=se([0,0,1]),S2=se([0,0,3]),E2=function(e){for(var t=[],r=1;r<e.length-2;)Ue(e.subarray(r,r+3),S2)&&(t.push(r+2),r++),r++;if(t.length===0)return e;var s=e.length-t.length,n=new Uint8Array(s),a=0;for(r=0;r<s;a++,r++)a===t[0]&&(a++,t.shift()),n[r]=e[a];return n},Vf=function(e,t,r,s){e=se(e),r=[].concat(r);for(var n=0,a,l=0;n<e.length&&(l<s||a);){var u=void 0;if(Ue(e.subarray(n),b2)?u=4:Ue(e.subarray(n),x2)&&(u=3),!u){n++;continue}if(l++,a)return E2(e.subarray(a,n));var f=void 0;t==="h264"?f=e[n+u]&31:t==="h265"&&(f=e[n+u]>>1&63),r.indexOf(f)!==-1&&(a=n+u),n+=u+(t==="h264"?1:2)}return e.subarray(0,0)},C2=function(e,t,r){return Vf(e,"h264",t,r)},A2=function(e,t,r){return Vf(e,"h265",t,r)},ct={webm:se([119,101,98,109]),matroska:se([109,97,116,114,111,115,107,97]),flac:se([102,76,97,67]),ogg:se([79,103,103,83]),ac3:se([11,119]),riff:se([82,73,70,70]),avi:se([65,86,73]),wav:se([87,65,86,69]),"3gp":se([102,116,121,112,51,103]),mp4:se([102,116,121,112]),fmp4:se([115,116,121,112]),mov:se([102,116,121,112,113,116]),moov:se([109,111,111,118]),moof:se([109,111,111,102])},Hr={aac:function(e){var t=Ms(e);return Ue(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Ms(e);return Ue(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=_d(e,[Vn.EBML,Vn.DocType])[0];return Ue(t,ct.webm)},mkv:function(e){var t=_d(e,[Vn.EBML,Vn.DocType])[0];return Ue(t,ct.matroska)},mp4:function(e){if(Hr["3gp"](e)||Hr.mov(e))return!1;if(Ue(e,ct.mp4,{offset:4})||Ue(e,ct.fmp4,{offset:4})||Ue(e,ct.moof,{offset:4})||Ue(e,ct.moov,{offset:4}))return!0},mov:function(e){return Ue(e,ct.mov,{offset:4})},"3gp":function(e){return Ue(e,ct["3gp"],{offset:4})},ac3:function(e){var t=Ms(e);return Ue(e,ct.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+188<e.length&&t<188;){if(e[t]===71&&e[t+188]===71)return!0;t+=1}return!1},flac:function(e){var t=Ms(e);return Ue(e,ct.flac,{offset:t})},ogg:function(e){return Ue(e,ct.ogg)},avi:function(e){return Ue(e,ct.riff)&&Ue(e,ct.avi,{offset:8})},wav:function(e){return Ue(e,ct.riff)&&Ue(e,ct.wav,{offset:8})},h264:function(e){return C2(e,7,3).length},h265:function(e){return A2(e,[32,33],3).length}},el=Object.keys(Hr).filter(function(i){return i!=="ts"&&i!=="h264"&&i!=="h265"}).concat(["ts","h264","h265"]);el.forEach(function(i){var e=Hr[i];Hr[i]=function(t){return e(se(t))}});var w2=Hr,Gl=function(e){e=se(e);for(var t=0;t<el.length;t++){var r=el[t];if(w2[r](e))return r}return""},D2=function(e){return y2(e,["moof"]).length>0},Kl=9e4,Xl,Yl,Ma,Ql,qf,Hf,zf;Xl=function(i){return i*Kl};Yl=function(i,e){return i*e};Ma=function(i){return i/Kl};Ql=function(i,e){return i/e};qf=function(i,e){return Xl(Ql(i,e))};Hf=function(i,e){return Yl(Ma(i),e)};zf=function(i,e,t){return Ma(t?i:i-e)};var tr={ONE_SECOND_IN_TS:Kl,secondsToVideoTs:Xl,secondsToAudioTs:Yl,videoTsToSeconds:Ma,audioTsToSeconds:Ql,audioTsToVideoTs:qf,videoTsToAudioTs:Hf,metadataTsToSeconds:zf},tl="8.21.0";const yi={},ji=function(i,e){return yi[i]=yi[i]||[],e&&(yi[i]=yi[i].concat(e)),yi[i]},I2=function(i,e){ji(i,e)},Wf=function(i,e){const t=ji(i).indexOf(e);return t<=-1?!1:(yi[i]=yi[i].slice(),yi[i].splice(t,1),!0)},k2=function(i,e){ji(i,[].concat(e).map(t=>{const r=(...s)=>(Wf(i,r),t(...s));return r}))},na={prefixed:!0},Xn=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Td=Xn[0];let Us;for(let i=0;i<Xn.length;i++)if(Xn[i][1]in X){Us=Xn[i];break}if(Us){for(let i=0;i<Us.length;i++)na[Td[i]]=Us[i];na.prefixed=Us[0]!==Td[0]}let gt=[];const P2=(i,e,t)=>(r,s,n)=>{const a=e.levels[s],l=new RegExp(`^(${a})$`);let u=i;if(r!=="log"&&n.unshift(r.toUpperCase()+":"),t&&(u=`%c${i}`,n.unshift(t)),n.unshift(u+":"),gt){gt.push([].concat(n));const p=gt.length-1e3;gt.splice(0,p>0?p:0)}if(!k.console)return;let f=k.console[r];!f&&r==="debug"&&(f=k.console.info||k.console.log),!(!f||!a||!l.test(r))&&f[Array.isArray(n)?"apply":"call"](k.console,n)};function il(i,e=":",t=""){let r="info",s;function n(...a){s("log",r,a)}return s=P2(i,n,t),n.createLogger=(a,l,u)=>{const f=l!==void 0?l:e,p=u!==void 0?u:t,T=`${i} ${f} ${a}`;return il(T,f,p)},n.createNewLogger=(a,l,u)=>il(a,l,u),n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:r},n.level=a=>{if(typeof a=="string"){if(!n.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);r=a}return r},n.history=()=>gt?[].concat(gt):[],n.history.filter=a=>(gt||[]).filter(l=>new RegExp(`.*${a}.*`).test(l[0])),n.history.clear=()=>{gt&&(gt.length=0)},n.history.disable=()=>{gt!==null&&(gt.length=0,gt=null)},n.history.enable=()=>{gt===null&&(gt=[])},n.error=(...a)=>s("error",r,a),n.warn=(...a)=>s("warn",r,a),n.debug=(...a)=>s("debug",r,a),n}const fe=il("VIDEOJS"),Gf=fe.createLogger,L2=Object.prototype.toString,Kf=function(i){return di(i)?Object.keys(i):[]};function kr(i,e){Kf(i).forEach(t=>e(i[t],t))}function Xf(i,e,t=0){return Kf(i).reduce((r,s)=>e(r,i[s],s),t)}function di(i){return!!i&&typeof i=="object"}function zr(i){return di(i)&&L2.call(i)==="[object Object]"&&i.constructor===Object}function Ae(...i){const e={};return i.forEach(t=>{t&&kr(t,(r,s)=>{if(!zr(r)){e[s]=r;return}zr(e[s])||(e[s]={}),e[s]=Ae(e[s],r)})}),e}function Yf(i={}){const e=[];for(const t in i)if(i.hasOwnProperty(t)){const r=i[t];e.push(r)}return e}function Ua(i,e,t,r=!0){const s=a=>Object.defineProperty(i,e,{value:a,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){const a=t();return s(a),a}};return r&&(n.set=s),Object.defineProperty(i,e,n)}var R2=Object.freeze({__proto__:null,each:kr,reduce:Xf,isObject:di,isPlain:zr,merge:Ae,values:Yf,defineLazyProperty:Ua});let Jl=!1,Qf=null,Gt=!1,Jf,Zf=!1,Pr=!1,Lr=!1,hi=!1,Zl=null,Fa=null;const O2=!!(k.cast&&k.cast.framework&&k.cast.framework.CastReceiverContext);let ep=null,aa=!1,$a=!1,oa=!1,ja=!1,la=!1,ua=!1,ca=!1;const Zs=!!(Jr()&&("ontouchstart"in k||k.navigator.maxTouchPoints||k.DocumentTouch&&k.document instanceof k.DocumentTouch)),Bi=k.navigator&&k.navigator.userAgentData;Bi&&Bi.platform&&Bi.brands&&(Gt=Bi.platform==="Android",Pr=!!Bi.brands.find(i=>i.brand==="Microsoft Edge"),Lr=!!Bi.brands.find(i=>i.brand==="Chromium"),hi=!Pr&&Lr,Zl=Fa=(Bi.brands.find(i=>i.brand==="Chromium")||{}).version||null,$a=Bi.platform==="Windows");if(!Lr){const i=k.navigator&&k.navigator.userAgent||"";Jl=/iPod/i.test(i),Qf=function(){const e=i.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Gt=/Android/i.test(i),Jf=function(){const e=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),r=e[2]&&parseFloat(e[2]);return t&&r?parseFloat(e[1]+"."+e[2]):t||null}(),Zf=/Firefox/i.test(i),Pr=/Edg/i.test(i),Lr=/Chrome/i.test(i)||/CriOS/i.test(i),hi=!Pr&&Lr,Zl=Fa=function(){const e=i.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),ep=function(){const e=/MSIE\s(\d+)\.\d/.exec(i);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(i)&&/rv:11.0/.test(i)&&(t=11),t}(),la=/Tizen/i.test(i),ua=/Web0S/i.test(i),ca=la||ua,aa=/Safari/i.test(i)&&!hi&&!Gt&&!Pr&&!ca,$a=/Windows/i.test(i),oa=/iPad/i.test(i)||aa&&Zs&&!/iPhone/i.test(i),ja=/iPhone/i.test(i)&&!oa}const st=ja||oa||Jl,Va=(aa||st)&&!hi;var tp=Object.freeze({__proto__:null,get IS_IPOD(){return Jl},get IOS_VERSION(){return Qf},get IS_ANDROID(){return Gt},get ANDROID_VERSION(){return Jf},get IS_FIREFOX(){return Zf},get IS_EDGE(){return Pr},get IS_CHROMIUM(){return Lr},get IS_CHROME(){return hi},get CHROMIUM_VERSION(){return Zl},get CHROME_VERSION(){return Fa},IS_CHROMECAST_RECEIVER:O2,get IE_VERSION(){return ep},get IS_SAFARI(){return aa},get IS_WINDOWS(){return $a},get IS_IPAD(){return oa},get IS_IPHONE(){return ja},get IS_TIZEN(){return la},get IS_WEBOS(){return ua},get IS_SMART_TV(){return ca},TOUCH_ENABLED:Zs,IS_IOS:st,IS_ANY_SAFARI:Va});function vd(i){return typeof i=="string"&&!!i.trim()}function N2(i){if(i.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Jr(){return X===k.document}function Zr(i){return di(i)&&i.nodeType===1}function ip(){try{return k.parent!==k.self}catch{return!0}}function rp(i){return function(e,t){if(!vd(e))return X[i](null);vd(t)&&(t=X.querySelector(t));const r=Zr(t)?t:X;return r[i]&&r[i](e)}}function ne(i="div",e={},t={},r){const s=X.createElement(i);return Object.getOwnPropertyNames(e).forEach(function(n){const a=e[n];n==="textContent"?Hi(s,a):(s[n]!==a||n==="tabIndex")&&(s[n]=a)}),Object.getOwnPropertyNames(t).forEach(function(n){s.setAttribute(n,t[n])}),r&&eu(s,r),s}function Hi(i,e){return typeof i.textContent>"u"?i.innerText=e:i.textContent=e,i}function rl(i,e){e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i)}function Vs(i,e){return N2(e),i.classList.contains(e)}function sr(i,...e){return i.classList.add(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i}function qa(i,...e){return i?(i.classList.remove(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i):(fe.warn("removeClass was called with an element that doesn't exist"),null)}function sp(i,e,t){return typeof t=="function"&&(t=t(i,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(r=>i.classList.toggle(r,t)),i}function np(i,e){Object.getOwnPropertyNames(e).forEach(function(t){const r=e[t];r===null||typeof r>"u"||r===!1?i.removeAttribute(t):i.setAttribute(t,r===!0?"":r)})}function Fi(i){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(i&&i.attributes&&i.attributes.length>0){const r=i.attributes;for(let s=r.length-1;s>=0;s--){const n=r[s].name;let a=r[s].value;t.includes(n)&&(a=a!==null),e[n]=a}}return e}function ap(i,e){return i.getAttribute(e)}function Wr(i,e,t){i.setAttribute(e,t)}function Ha(i,e){i.removeAttribute(e)}function op(){X.body.focus(),X.onselectstart=function(){return!1}}function lp(){X.onselectstart=function(){return!0}}function Gr(i){if(i&&i.getBoundingClientRect&&i.parentNode){const e=i.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(r=>{e[r]!==void 0&&(t[r]=e[r])}),t.height||(t.height=parseFloat(Kr(i,"height"))),t.width||(t.width=parseFloat(Kr(i,"width"))),t}}function en(i){if(!i||i&&!i.offsetParent)return{left:0,top:0,width:0,height:0};const e=i.offsetWidth,t=i.offsetHeight;let r=0,s=0;for(;i.offsetParent&&i!==X[na.fullscreenElement];)r+=i.offsetLeft,s+=i.offsetTop,i=i.offsetParent;return{left:r,top:s,width:e,height:t}}function za(i,e){const t={x:0,y:0};if(st){let p=i;for(;p&&p.nodeName.toLowerCase()!=="html";){const T=Kr(p,"transform");if(/^matrix/.test(T)){const b=T.slice(7,-1).split(/,\s/).map(Number);t.x+=b[4],t.y+=b[5]}else if(/^matrix3d/.test(T)){const b=T.slice(9,-1).split(/,\s/).map(Number);t.x+=b[12],t.y+=b[13]}if(p.assignedSlot&&p.assignedSlot.parentElement&&k.WebKitCSSMatrix){const b=k.getComputedStyle(p.assignedSlot.parentElement).transform,S=new k.WebKitCSSMatrix(b);t.x+=S.m41,t.y+=S.m42}p=p.parentNode||p.host}}const r={},s=en(e.target),n=en(i),a=n.width,l=n.height;let u=e.offsetY-(n.top-s.top),f=e.offsetX-(n.left-s.left);return e.changedTouches&&(f=e.changedTouches[0].pageX-n.left,u=e.changedTouches[0].pageY+n.top,st&&(f-=t.x,u-=t.y)),r.y=1-Math.max(0,Math.min(1,u/l)),r.x=Math.max(0,Math.min(1,f/a)),r}function up(i){return di(i)&&i.nodeType===3}function Wa(i){for(;i.firstChild;)i.removeChild(i.firstChild);return i}function cp(i){return typeof i=="function"&&(i=i()),(Array.isArray(i)?i:[i]).map(e=>{if(typeof e=="function"&&(e=e()),Zr(e)||up(e))return e;if(typeof e=="string"&&/\S/.test(e))return X.createTextNode(e)}).filter(e=>e)}function eu(i,e){return cp(e).forEach(t=>i.appendChild(t)),i}function dp(i,e){return eu(Wa(i),e)}function tn(i){return i.button===void 0&&i.buttons===void 0||i.button===0&&i.buttons===void 0||i.type==="mouseup"&&i.button===0&&i.buttons===0||i.type==="mousedown"&&i.button===0&&i.buttons===0?!0:!(i.button!==0||i.buttons!==1)}const Vi=rp("querySelector"),hp=rp("querySelectorAll");function Kr(i,e){if(!i||!e)return"";if(typeof k.getComputedStyle=="function"){let t;try{t=k.getComputedStyle(i)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function fp(i){[...X.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(s=>s.cssText).join(""),r=X.createElement("style");r.textContent=t,i.document.head.appendChild(r)}catch{const r=X.createElement("link");r.rel="stylesheet",r.type=e.type,r.media=e.media.mediaText,r.href=e.href,i.document.head.appendChild(r)}})}var pp=Object.freeze({__proto__:null,isReal:Jr,isEl:Zr,isInFrame:ip,createEl:ne,textContent:Hi,prependTo:rl,hasClass:Vs,addClass:sr,removeClass:qa,toggleClass:sp,setAttributes:np,getAttributes:Fi,getAttribute:ap,setAttribute:Wr,removeAttribute:Ha,blockTextSelection:op,unblockTextSelection:lp,getBoundingClientRect:Gr,findPosition:en,getPointerPosition:za,isTextNode:up,emptyEl:Wa,normalizeContent:cp,appendContent:eu,insertContent:dp,isSingleLeftClick:tn,$:Vi,$$:hp,computedStyle:Kr,copyStyleSheetsToWindow:fp});let mp=!1,sl;const B2=function(){if(sl.options.autoSetup===!1)return;const i=Array.prototype.slice.call(X.getElementsByTagName("video")),e=Array.prototype.slice.call(X.getElementsByTagName("audio")),t=Array.prototype.slice.call(X.getElementsByTagName("video-js")),r=i.concat(e,t);if(r&&r.length>0)for(let s=0,n=r.length;s<n;s++){const a=r[s];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&sl(a);else{nl(1);break}}else mp||nl(1)};function nl(i,e){Jr()&&(e&&(sl=e),k.setTimeout(B2,i))}function al(){mp=!0,k.removeEventListener("load",al)}Jr()&&(X.readyState==="complete"?al():k.addEventListener("load",al));const gp=function(i){const e=X.createElement("style");return e.className=i,e},yp=function(i,e){i.styleSheet?i.styleSheet.cssText=e:i.textContent=e};var ft=new WeakMap;const M2=3;let U2=M2;function Ut(){return U2++}function bd(i,e){if(!ft.has(i))return;const t=ft.get(i);t.handlers[e].length===0&&(delete t.handlers[e],i.removeEventListener?i.removeEventListener(e,t.dispatcher,!1):i.detachEvent&&i.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&ft.delete(i)}function tu(i,e,t,r){t.forEach(function(s){i(e,s,r)})}function Ga(i){if(i.fixed_)return i;function e(){return!0}function t(){return!1}if(!i||!i.isPropagationStopped||!i.isImmediatePropagationStopped){const r=i||k.event;i={};const s=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const n in r)s.includes(n)||n==="returnValue"&&r.preventDefault||(i[n]=r[n]);if(i.target||(i.target=i.srcElement||X),i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement),i.preventDefault=function(){r.preventDefault&&r.preventDefault(),i.returnValue=!1,r.returnValue=!1,i.defaultPrevented=!0},i.defaultPrevented=!1,i.stopPropagation=function(){r.stopPropagation&&r.stopPropagation(),i.cancelBubble=!0,r.cancelBubble=!0,i.isPropagationStopped=e},i.isPropagationStopped=t,i.stopImmediatePropagation=function(){r.stopImmediatePropagation&&r.stopImmediatePropagation(),i.isImmediatePropagationStopped=e,i.stopPropagation()},i.isImmediatePropagationStopped=t,i.clientX!==null&&i.clientX!==void 0){const n=X.documentElement,a=X.body;i.pageX=i.clientX+(n&&n.scrollLeft||a&&a.scrollLeft||0)-(n&&n.clientLeft||a&&a.clientLeft||0),i.pageY=i.clientY+(n&&n.scrollTop||a&&a.scrollTop||0)-(n&&n.clientTop||a&&a.clientTop||0)}i.which=i.charCode||i.keyCode,i.button!==null&&i.button!==void 0&&(i.button=i.button&1?0:i.button&4?1:i.button&2?2:0)}return i.fixed_=!0,i}let qn;const F2=function(){if(typeof qn!="boolean"){qn=!1;try{const i=Object.defineProperty({},"passive",{get(){qn=!0}});k.addEventListener("test",null,i),k.removeEventListener("test",null,i)}catch{}}return qn},$2=["touchstart","touchmove"];function It(i,e,t){if(Array.isArray(e))return tu(It,i,e,t);ft.has(i)||ft.set(i,{});const r=ft.get(i);if(r.handlers||(r.handlers={}),r.handlers[e]||(r.handlers[e]=[]),t.guid||(t.guid=Ut()),r.handlers[e].push(t),r.dispatcher||(r.disabled=!1,r.dispatcher=function(s,n){if(r.disabled)return;s=Ga(s);const a=r.handlers[s.type];if(a){const l=a.slice(0);for(let u=0,f=l.length;u<f&&!s.isImmediatePropagationStopped();u++)try{l[u].call(i,s,n)}catch(p){fe.error(p)}}}),r.handlers[e].length===1)if(i.addEventListener){let s=!1;F2()&&$2.indexOf(e)>-1&&(s={passive:!0}),i.addEventListener(e,r.dispatcher,s)}else i.attachEvent&&i.attachEvent("on"+e,r.dispatcher)}function nt(i,e,t){if(!ft.has(i))return;const r=ft.get(i);if(!r.handlers)return;if(Array.isArray(e))return tu(nt,i,e,t);const s=function(a,l){r.handlers[l]=[],bd(a,l)};if(e===void 0){for(const a in r.handlers)Object.prototype.hasOwnProperty.call(r.handlers||{},a)&&s(i,a);return}const n=r.handlers[e];if(n){if(!t){s(i,e);return}if(t.guid)for(let a=0;a<n.length;a++)n[a].guid===t.guid&&n.splice(a--,1);bd(i,e)}}function es(i,e,t){const r=ft.has(i)?ft.get(i):{},s=i.parentNode||i.ownerDocument;if(typeof e=="string"?e={type:e,target:i}:e.target||(e.target=i),e=Ga(e),r.dispatcher&&r.dispatcher.call(i,e,t),s&&!e.isPropagationStopped()&&e.bubbles===!0)es.call(null,s,e,t);else if(!s&&!e.defaultPrevented&&e.target&&e.target[e.type]){ft.has(e.target)||ft.set(e.target,{});const n=ft.get(e.target);e.target[e.type]&&(n.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),n.disabled=!1)}return!e.defaultPrevented}function Ka(i,e,t){if(Array.isArray(e))return tu(Ka,i,e,t);const r=function(){nt(i,e,r),t.apply(this,arguments)};r.guid=t.guid=t.guid||Ut(),It(i,e,r)}function iu(i,e,t){const r=function(){nt(i,e,r),t.apply(this,arguments)};r.guid=t.guid=t.guid||Ut(),It(i,e,r)}var j2=Object.freeze({__proto__:null,fixEvent:Ga,on:It,off:nt,trigger:es,one:Ka,any:iu});const Ft=30,Pe=function(i,e,t){e.guid||(e.guid=Ut());const r=e.bind(i);return r.guid=t?t+"_"+e.guid:e.guid,r},fi=function(i,e){let t=k.performance.now();return function(...s){const n=k.performance.now();n-t>=e&&(i(...s),t=n)}},_p=function(i,e,t,r=k){let s;const n=()=>{r.clearTimeout(s),s=null},a=function(){const l=this,u=arguments;let f=function(){s=null,f=null,t||i.apply(l,u)};!s&&t&&i.apply(l,u),r.clearTimeout(s),s=r.setTimeout(f,e)};return a.cancel=n,a};var V2=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Ft,bind_:Pe,throttle:fi,debounce:_p});let ks;class kt{on(e,t){const r=this.addEventListener;this.addEventListener=()=>{},It(this,e,t),this.addEventListener=r}off(e,t){nt(this,e,t)}one(e,t){const r=this.addEventListener;this.addEventListener=()=>{},Ka(this,e,t),this.addEventListener=r}any(e,t){const r=this.addEventListener;this.addEventListener=()=>{},iu(this,e,t),this.addEventListener=r}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=Ga(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),es(this,e)}queueTrigger(e){ks||(ks=new Map);const t=e.type||e;let r=ks.get(this);r||(r=new Map,ks.set(this,r));const s=r.get(t);r.delete(t),k.clearTimeout(s);const n=k.setTimeout(()=>{r.delete(t),r.size===0&&(r=null,ks.delete(this)),this.trigger(e)},0);r.set(t,n)}}kt.prototype.allowedEvents_={};kt.prototype.addEventListener=kt.prototype.on;kt.prototype.removeEventListener=kt.prototype.off;kt.prototype.dispatchEvent=kt.prototype.trigger;const Xa=i=>typeof i.name=="function"?i.name():typeof i.name=="string"?i.name:i.name_?i.name_:i.constructor&&i.constructor.name?i.constructor.name:typeof i,vi=i=>i instanceof kt||!!i.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof i[e]=="function"),q2=(i,e)=>{vi(i)?e():(i.eventedCallbacks||(i.eventedCallbacks=[]),i.eventedCallbacks.push(e))},ol=i=>typeof i=="string"&&/\S/.test(i)||Array.isArray(i)&&!!i.length,da=(i,e,t)=>{if(!i||!i.nodeName&&!vi(i))throw new Error(`Invalid target for ${Xa(e)}#${t}; must be a DOM node or evented object.`)},Tp=(i,e,t)=>{if(!ol(i))throw new Error(`Invalid event type for ${Xa(e)}#${t}; must be a non-empty string or array.`)},vp=(i,e,t)=>{if(typeof i!="function")throw new Error(`Invalid listener for ${Xa(e)}#${t}; must be a function.`)},Lo=(i,e,t)=>{const r=e.length<3||e[0]===i||e[0]===i.eventBusEl_;let s,n,a;return r?(s=i.eventBusEl_,e.length>=3&&e.shift(),[n,a]=e):(s=e[0],n=e[1],a=e[2]),da(s,i,t),Tp(n,i,t),vp(a,i,t),a=Pe(i,a),{isTargetingSelf:r,target:s,type:n,listener:a}},Ji=(i,e,t,r)=>{da(i,i,e),i.nodeName?j2[e](i,t,r):i[e](t,r)},H2={on(...i){const{isTargetingSelf:e,target:t,type:r,listener:s}=Lo(this,i,"on");if(Ji(t,"on",r,s),!e){const n=()=>this.off(t,r,s);n.guid=s.guid;const a=()=>this.off("dispose",n);a.guid=s.guid,Ji(this,"on","dispose",n),Ji(t,"on","dispose",a)}},one(...i){const{isTargetingSelf:e,target:t,type:r,listener:s}=Lo(this,i,"one");if(e)Ji(t,"one",r,s);else{const n=(...a)=>{this.off(t,r,n),s.apply(null,a)};n.guid=s.guid,Ji(t,"one",r,n)}},any(...i){const{isTargetingSelf:e,target:t,type:r,listener:s}=Lo(this,i,"any");if(e)Ji(t,"any",r,s);else{const n=(...a)=>{this.off(t,r,n),s.apply(null,a)};n.guid=s.guid,Ji(t,"any",r,n)}},off(i,e,t){if(!i||ol(i))nt(this.eventBusEl_,i,e);else{const r=i,s=e;da(r,this,"off"),Tp(s,this,"off"),vp(t,this,"off"),t=Pe(this,t),this.off("dispose",t),r.nodeName?(nt(r,s,t),nt(r,"dispose",t)):vi(r)&&(r.off(s,t),r.off("dispose",t))}},trigger(i,e){da(this.eventBusEl_,this,"trigger");const t=i&&typeof i!="string"?i.type:i;if(!ol(t))throw new Error(`Invalid event type for ${Xa(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return es(this.eventBusEl_,i,e)}};function ru(i,e={}){const{eventBusKey:t}=e;if(t){if(!i[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);i.eventBusEl_=i[t]}else i.eventBusEl_=ne("span",{className:"vjs-event-bus"});return Object.assign(i,H2),i.eventedCallbacks&&i.eventedCallbacks.forEach(r=>{r()}),i.on("dispose",()=>{i.off(),[i,i.el_,i.eventBusEl_].forEach(function(r){r&&ft.has(r)&&ft.delete(r)}),k.setTimeout(()=>{i.eventBusEl_=null},0)}),i}const z2={state:{},setState(i){typeof i=="function"&&(i=i());let e;return kr(i,(t,r)=>{this.state[r]!==t&&(e=e||{},e[r]={from:this.state[r],to:t}),this.state[r]=t}),e&&vi(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function bp(i,e){return Object.assign(i,z2),i.state=Object.assign({},i.state,e),typeof i.handleStateChanged=="function"&&vi(i)&&i.on("statechanged",i.handleStateChanged),i}const qs=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toLowerCase())},He=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},xp=function(i,e){return He(i)===He(e)};var W2=Object.freeze({__proto__:null,toLowerCase:qs,toTitleCase:He,titleCaseEquals:xp});class H{constructor(e,t,r){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Ae({},this.options_),t=this.options_=Ae(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const s=e&&e.id&&e.id()||"no_player";this.id_=`${s}_component_${Ut()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(s=>this.addClass(s)),["on","off","one","any","trigger"].forEach(s=>{this[s]=void 0}),t.evented!==!1&&(ru(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),bp(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(r),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=Ae(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,r){return ne(e,t,r)}localize(e,t,r=e){const s=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),a=n&&n[s],l=s&&s.split("-")[0],u=n&&n[l];let f=r;return a&&a[e]?f=a[e]:u&&u[e]&&(f=u[e]),t&&(f=f.replace(/\{(\d+)\}/g,function(p,T){const b=t[T-1];let S=b;return typeof b>"u"&&(S=p),S})),f}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((r,s)=>r.concat(s),[]);let t=this;for(let r=0;r<e.length;r++)if(t=t.getChild(e[r]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const r="http://www.w3.org/2000/svg",s=ne("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),n=X.createElementNS(r,"svg");n.setAttributeNS(null,"viewBox","0 0 512 512");const a=X.createElementNS(r,"use");return n.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),s.appendChild(n),this.iconIsSet_?t.replaceChild(s,t.querySelector(".vjs-icon-placeholder")):t.appendChild(s),this.iconIsSet_=!0,s}addChild(e,t={},r=this.children_.length){let s,n;if(typeof e=="string"){n=He(e);const a=t.componentClass||n;t.name=n;const l=H.getComponent(a);if(!l)throw new Error(`Component ${a} does not exist`);if(typeof l!="function")return null;s=new l(this.player_||this,t)}else s=e;if(s.parentComponent_&&s.parentComponent_.removeChild(s),this.children_.splice(r,0,s),s.parentComponent_=this,typeof s.id=="function"&&(this.childIndex_[s.id()]=s),n=n||s.name&&He(s.name()),n&&(this.childNameIndex_[n]=s,this.childNameIndex_[qs(n)]=s),typeof s.el=="function"&&s.el()){let a=null;this.children_[r+1]&&(this.children_[r+1].el_?a=this.children_[r+1].el_:Zr(this.children_[r+1])&&(a=this.children_[r+1])),this.contentEl().insertBefore(s.el(),a)}return s}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let s=this.children_.length-1;s>=0;s--)if(this.children_[s]===e){t=!0,this.children_.splice(s,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[He(e.name())]=null,this.childNameIndex_[qs(e.name())]=null;const r=e.el();r&&r.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,r=a=>{const l=a.name;let u=a.opts;if(t[l]!==void 0&&(u=t[l]),u===!1)return;u===!0&&(u={}),u.playerOptions=this.options_.playerOptions;const f=this.addChild(l,u);f&&(this[l]=f)};let s;const n=H.getComponent("Tech");Array.isArray(e)?s=e:s=Object.keys(e),s.concat(Object.keys(this.options_).filter(function(a){return!s.some(function(l){return typeof l=="string"?a===l:a===l.name})})).map(a=>{let l,u;return typeof a=="string"?(l=a,u=e[l]||this.options_[l]||{}):(l=a.name,u=a),{name:l,opts:u}}).filter(a=>{const l=H.getComponent(a.opts.componentClass||He(a.name));return l&&!n.isTech(l)}).forEach(r)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Vi(e,t||this.contentEl())}$$(e,t){return hp(e,t||this.contentEl())}hasClass(e){return Vs(this.el_,e)}addClass(...e){sr(this.el_,...e)}removeClass(...e){qa(this.el_,...e)}toggleClass(e,t){sp(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return ap(this.el_,e)}setAttribute(e,t){Wr(this.el_,e,t)}removeAttribute(e){Ha(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,r){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",r||this.trigger("componentresize");return}if(!this.el_)return 0;const s=this.el_.style[e],n=s.indexOf("px");return parseInt(n!==-1?s.slice(0,n):this.el_["offset"+He(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Kr(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const r=`offset${He(e)}`;t=this.el_[r]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},r={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:r}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const r=10,s=200;let n;this.on("touchstart",function(l){l.touches.length===1&&(t={pageX:l.touches[0].pageX,pageY:l.touches[0].pageY},e=k.performance.now(),n=!0)}),this.on("touchmove",function(l){if(l.touches.length>1)n=!1;else if(t){const u=l.touches[0].pageX-t.pageX,f=l.touches[0].pageY-t.pageY;Math.sqrt(u*u+f*f)>r&&(n=!1)}});const a=function(){n=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(l){t=null,n===!0&&k.performance.now()-e<s&&(l.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Pe(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const r=function(s){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",r),this.on("touchcancel",r)}setTimeout(e,t){var r;return e=Pe(this,e),this.clearTimersOnDispose_(),r=k.setTimeout(()=>{this.setTimeoutIds_.has(r)&&this.setTimeoutIds_.delete(r),e()},t),this.setTimeoutIds_.add(r),r}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),k.clearTimeout(e)),e}setInterval(e,t){e=Pe(this,e),this.clearTimersOnDispose_();const r=k.setInterval(e,t);return this.setIntervalIds_.add(r),r}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),k.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Pe(this,e),t=k.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Pe(this,t);const r=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,r),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),k.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((r,s)=>this[t](s))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(n){const a=k.getComputedStyle(n,null),l=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(l)}function r(n){return!(!t(n.parentElement)||!t(n)||n.style.opacity==="0"||k.getComputedStyle(n).height==="0px"||k.getComputedStyle(n).width==="0px")}function s(n){if(n.offsetWidth+n.offsetHeight+n.getBoundingClientRect().height+n.getBoundingClientRect().width===0)return!1;const a={x:n.getBoundingClientRect().left+n.offsetWidth/2,y:n.getBoundingClientRect().top+n.offsetHeight/2};if(a.x<0||a.x>(X.documentElement.clientWidth||k.innerWidth)||a.y<0||a.y>(X.documentElement.clientHeight||k.innerHeight))return!1;let l=X.elementFromPoint(a.x,a.y);for(;l;){if(l===n)return!0;if(l.parentNode)l=l.parentNode;else return!1}}return e||(e=this.el()),!!(s(e)&&r(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const r=H.getComponent("Tech"),s=r&&r.isTech(t),n=H===t||H.prototype.isPrototypeOf(t.prototype);if(s||!n){let l;throw s?l="techs must be registered using Tech.registerTech()":l="must be a Component subclass",new Error(`Illegal component, "${e}"; ${l}.`)}e=He(e),H.components_||(H.components_={});const a=H.getComponent("Player");if(e==="Player"&&a&&a.players){const l=a.players,u=Object.keys(l);if(l&&u.length>0&&u.map(f=>l[f]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return H.components_[e]=t,H.components_[qs(e)]=t,t}static getComponent(e){if(!(!e||!H.components_))return H.components_[e]}}H.registerComponent("Component",H);function G2(i,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${i}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function xd(i,e,t,r){return G2(i,r,t.length-1),t[r][e]}function Ro(i){let e;return i===void 0||i.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:i.length,start:xd.bind(null,"start",0,i),end:xd.bind(null,"end",1,i)},k.Symbol&&k.Symbol.iterator&&(e[k.Symbol.iterator]=()=>(i||[]).values()),e}function Wt(i,e){return Array.isArray(i)?Ro(i):i===void 0||e===void 0?Ro():Ro([[i,e]])}const Sp=function(i,e){i=i<0?0:i;let t=Math.floor(i%60),r=Math.floor(i/60%60),s=Math.floor(i/3600);const n=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(s=r=t="-"),s=s>0||a>0?s+":":"",r=((s||n>=10)&&r<10?"0"+r:r)+":",t=t<10?"0"+t:t,s+r+t};let su=Sp;function Ep(i){su=i}function Cp(){su=Sp}function ur(i,e=i){return su(i,e)}var K2=Object.freeze({__proto__:null,createTimeRanges:Wt,createTimeRange:Wt,setFormatTime:Ep,resetFormatTime:Cp,formatTime:ur});function Ap(i,e){let t=0,r,s;if(!e)return 0;(!i||!i.length)&&(i=Wt(0,0));for(let n=0;n<i.length;n++)r=i.start(n),s=i.end(n),s>e&&(s=e),t+=s-r;return t/e}function je(i){if(i instanceof je)return i;typeof i=="number"?this.code=i:typeof i=="string"?this.message=i:di(i)&&(typeof i.code=="number"&&(this.code=i.code),Object.assign(this,i)),this.message||(this.message=je.defaultMessages[this.code]||"")}je.prototype.code=0;je.prototype.message="";je.prototype.status=null;je.prototype.metadata=null;je.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];je.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};je.MEDIA_ERR_CUSTOM=0;je.prototype.MEDIA_ERR_CUSTOM=0;je.MEDIA_ERR_ABORTED=1;je.prototype.MEDIA_ERR_ABORTED=1;je.MEDIA_ERR_NETWORK=2;je.prototype.MEDIA_ERR_NETWORK=2;je.MEDIA_ERR_DECODE=3;je.prototype.MEDIA_ERR_DECODE=3;je.MEDIA_ERR_SRC_NOT_SUPPORTED=4;je.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;je.MEDIA_ERR_ENCRYPTED=5;je.prototype.MEDIA_ERR_ENCRYPTED=5;function Hs(i){return i!=null&&typeof i.then=="function"}function si(i){Hs(i)&&i.then(null,e=>{})}const ll=function(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,r,s)=>(i[r]&&(t[r]=i[r]),t),{cues:i.cues&&Array.prototype.map.call(i.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},X2=function(i){const e=i.$$("track"),t=Array.prototype.map.call(e,s=>s.track);return Array.prototype.map.call(e,function(s){const n=ll(s.track);return s.src&&(n.src=s.src),n}).concat(Array.prototype.filter.call(i.textTracks(),function(s){return t.indexOf(s)===-1}).map(ll))},Y2=function(i,e){return i.forEach(function(t){const r=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(s=>r.addCue(s))}),e.textTracks()};var Sd={textTracksToJson:X2,jsonToTextTracks:Y2,trackToJson_:ll};const Oo="vjs-modal-dialog";class ts extends H{constructor(e,t){super(e,t),this.handleKeyDown_=r=>this.handleKeyDown(r),this.close_=r=>this.close(r),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=ne("div",{className:`${Oo}-content`},{role:"document"}),this.descEl_=ne("p",{className:`${Oo}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Hi(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${Oo} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let r=this.getChild("closeButton");if(t&&!r){const s=this.contentEl_;this.contentEl_=this.el_,r=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(r,"close",this.close_)}!t&&r&&(this.off(r,"close",this.close_),this.removeChild(r),r.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),r=t.parentNode,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,r.removeChild(t),this.empty(),dp(t,e),this.trigger("modalfill"),s?r.insertBefore(t,s):r.appendChild(t);const n=this.getChild("closeButton");n&&r.appendChild(n.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),Wa(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=X.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),r=this.el_.querySelector(":focus");let s;for(let n=0;n<t.length;n++)if(r===t[n]){s=n;break}X.activeElement===this.el_&&(s=0),e.shiftKey&&s===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&s===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof k.HTMLAnchorElement||t instanceof k.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof k.HTMLInputElement||t instanceof k.HTMLSelectElement||t instanceof k.HTMLTextAreaElement||t instanceof k.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof k.HTMLIFrameElement||t instanceof k.HTMLObjectElement||t instanceof k.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}ts.prototype.options_={pauseOnOpen:!0,temporary:!0};H.registerComponent("ModalDialog",ts);class Xr extends kt{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},vi(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let r=0,s=this.length;r<s;r++)if(this[r]===e){t=this[r],t.off&&t.off(),this.tracks_.splice(r,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let r=0,s=this.length;r<s;r++){const n=this[r];if(n.id===e){t=n;break}}return t}}Xr.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const i in Xr.prototype.allowedEvents_)Xr.prototype["on"+i]=null;const No=function(i,e){for(let t=0;t<i.length;t++)!Object.keys(i[t]).length||e.id===i[t].id||(i[t].enabled=!1)};class Q2 extends Xr{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){No(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&No(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,No(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const Bo=function(i,e){for(let t=0;t<i.length;t++)!Object.keys(i[t]).length||e.id===i[t].id||(i[t].selected=!1)};class J2 extends Xr{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Bo(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&Bo(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,Bo(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class wp extends Xr{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class Z2{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,r=e.length;t<r;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let r=0,s=this.trackElements_.length;r<s;r++)if(e===this.trackElements_[r].track){t=this.trackElements_[r];break}return t}removeTrackElement_(e){for(let t=0,r=this.trackElements_.length;t<r;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class ha{constructor(e){ha.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let r=0;const s=e.length;this.cues_=e,this.length_=e.length;const n=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<s)for(r=t;r<s;r++)n.call(this,r)}getCueById(e){let t=null;for(let r=0,s=this.length;r<s;r++){const n=this[r];if(n.id===e){t=n;break}}return t}}const e1={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},t1={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},i1={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Ed={disabled:"disabled",hidden:"hidden",showing:"showing"};class nu extends kt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Ut(),kind:e.kind||"",language:e.language||""};let r=e.label||"";for(const s in t)Object.defineProperty(this,s,{get(){return t[s]},set(){}});Object.defineProperty(this,"label",{get(){return r},set(s){s!==r&&(r=s,this.trigger("labelchange"))}})}}const au=function(i){return new URL(i,X.baseURI)},Dp=function(i){return new URL(i,X.baseURI).href},ou=function(i){if(typeof i=="string"){const t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(i);if(t)return t.pop().toLowerCase()}return""},Ya=function(i,e=k.location){return au(i).origin!==e.origin};var r1=Object.freeze({__proto__:null,parseUrl:au,getAbsoluteURL:Dp,getFileExtension:ou,isCrossOrigin:Ya});const Cd=function(i,e){const t=new k.WebVTT.Parser(k,k.vttjs,k.WebVTT.StringDecoder()),r=[];t.oncue=function(s){e.addCue(s)},t.onparsingerror=function(s){r.push(s)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(i),r.length>0&&(k.console&&k.console.groupCollapsed&&k.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),r.forEach(s=>fe.error(s)),k.console&&k.console.groupEnd&&k.console.groupEnd()),t.flush()},Ad=function(i,e){const t={uri:i},r=Ya(i);r&&(t.cors=r);const s=e.tech_.crossOrigin()==="use-credentials";s&&(t.withCredentials=s),Wh(t,Pe(this,function(n,a,l){if(n)return fe.error(n,a);e.loaded_=!0,typeof k.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],u=>{if(u.type==="vttjserror"){fe.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Cd(l,e)}):Cd(l,e)}))};class ln extends nu{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Ae(e,{kind:i1[e.kind]||"subtitles",language:e.language||e.srclang||""});let r=Ed[t.mode]||"disabled";const s=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(r="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const n=new ha(this.cues_),a=new ha(this.activeCues_);let l=!1;this.timeupdateHandler=Pe(this,function(f={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){f.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,l&&(this.trigger("cuechange"),l=!1),f.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const u=()=>{this.stopTracking()};this.tech_.one("dispose",u),r!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return r},set(f){Ed[f]&&r!==f&&(r=f,!this.preload_&&r!=="disabled"&&this.cues.length===0&&Ad(this.src,this),this.stopTracking(),r!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?n:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const f=this.tech_.currentTime(),p=[];for(let T=0,b=this.cues.length;T<b;T++){const S=this.cues[T];S.startTime<=f&&S.endTime>=f&&p.push(S)}if(l=!1,p.length!==this.activeCues_.length)l=!0;else for(let T=0;T<p.length;T++)this.activeCues_.indexOf(p[T])===-1&&(l=!0);return this.activeCues_=p,a.setCues_(this.activeCues_),a},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||t.kind!=="subtitles"&&t.kind!=="captions")&&Ad(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(!("getCueAsHTML"in t)){t=new k.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const s in e)s in t||(t[s]=e[s]);t.id=e.id,t.originalCue_=e}const r=this.tech_.textTracks();for(let s=0;s<r.length;s++)r[s]!==this&&r[s].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){const r=this.cues_[t];if(r===e||r.originalCue_&&r.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}ln.prototype.allowedEvents_={cuechange:"cuechange"};class Ip extends nu{constructor(e={}){const t=Ae(e,{kind:t1[e.kind]||""});super(t);let r=!1;Object.defineProperty(this,"enabled",{get(){return r},set(s){typeof s!="boolean"||s===r||(r=s,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class kp extends nu{constructor(e={}){const t=Ae(e,{kind:e1[e.kind]||""});super(t);let r=!1;Object.defineProperty(this,"selected",{get(){return r},set(s){typeof s!="boolean"||s===r||(r=s,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class Ei extends kt{constructor(e={}){super();let t;const r=new ln(e);this.kind=r.kind,this.src=r.src,this.srclang=r.language,this.label=r.label,this.default=r.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return r}}}),t=Ei.NONE,r.addEventListener("loadeddata",()=>{t=Ei.LOADED,this.trigger({type:"load",target:this})})}}Ei.prototype.allowedEvents_={load:"load"};Ei.NONE=0;Ei.LOADING=1;Ei.LOADED=2;Ei.ERROR=3;const Mt={audio:{ListClass:Q2,TrackClass:Ip,capitalName:"Audio"},video:{ListClass:J2,TrackClass:kp,capitalName:"Video"},text:{ListClass:wp,TrackClass:ln,capitalName:"Text"}};Object.keys(Mt).forEach(function(i){Mt[i].getterName=`${i}Tracks`,Mt[i].privateName=`${i}Tracks_`});const Yr={remoteText:{ListClass:wp,TrackClass:ln,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Z2,TrackClass:Ei,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},dt=Object.assign({},Mt,Yr);Yr.names=Object.keys(Yr);Mt.names=Object.keys(Mt);dt.names=[].concat(Yr.names).concat(Mt.names);function s1(i,e,t,r,s={}){const n=i.textTracks();s.kind=e,t&&(s.label=t),r&&(s.language=r),s.tech=i;const a=new dt.text.TrackClass(s);return n.addTrack(a),a}class ue extends H{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=r=>this.onDurationChange(r),this.trackProgress_=r=>this.trackProgress(r),this.trackCurrentTime_=r=>this.trackCurrentTime(r),this.stopTrackingCurrentTime_=r=>this.stopTrackingCurrentTime(r),this.disposeSourceHandler_=r=>this.disposeSourceHandler(r),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),dt.names.forEach(r=>{const s=dt[r];e&&e[s.getterName]&&(this[s.privateName]=e[s.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(r=>{e[`native${r}Tracks`]===!1&&(this[`featuresNative${r}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new dt.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Pe(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Wt(0,0)}bufferedPercent(){return Ap(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Mt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const r=this[`${t}Tracks`]()||[];let s=r.length;for(;s--;){const n=r[s];t==="text"&&this.removeRemoteTextTrack(n),r.removeTrack(n)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const r=e[t];this.removeRemoteTextTrack(r)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new je(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Wt(0,0):Wt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Mt.names.forEach(e=>{const t=Mt[e],r=()=>{this.trigger(`${e}trackchange`)},s=this[t.getterName]();s.addEventListener("removetrack",r),s.addEventListener("addtrack",r),this.on("dispose",()=>{s.removeEventListener("removetrack",r),s.removeEventListener("addtrack",r)})})}addWebVttScript_(){if(!k.WebVTT)if(X.body.contains(this.el())){if(!this.options_["vtt.js"]&&zr(qc)&&Object.keys(qc).length>0){this.trigger("vttjsloaded");return}const e=X.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),k.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),r=l=>e.addTrack(l.track),s=l=>e.removeTrack(l.track);t.on("addtrack",r),t.on("removetrack",s),this.addWebVttScript_();const n=()=>this.trigger("texttrackchange"),a=()=>{n();for(let l=0;l<e.length;l++){const u=e[l];u.removeEventListener("cuechange",n),u.mode==="showing"&&u.addEventListener("cuechange",n)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",r),t.off("removetrack",s),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let l=0;l<e.length;l++)e[l].removeEventListener("cuechange",n)})}addTextTrack(e,t,r){if(!e)throw new Error("TextTrack kind is required but was not provided");return s1(this,e,t,r)}createRemoteTextTrack(e){const t=Ae(e,{tech:this});return new Yr.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const r=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(r),this.remoteTextTracks().addTrack(r.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(r.track)),r}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Ut();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return ue.canPlayType(e.type)}static isTech(e){return e.prototype instanceof ue||e instanceof ue||e===ue}static registerTech(e,t){if(ue.techs_||(ue.techs_={}),!ue.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!ue.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!ue.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=He(e),ue.techs_[e]=t,ue.techs_[qs(e)]=t,e!=="Tech"&&ue.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(ue.techs_&&ue.techs_[e])return ue.techs_[e];if(e=He(e),k&&k.videojs&&k.videojs[e])return fe.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),k.videojs[e]}}}dt.names.forEach(function(i){const e=dt[i];ue.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});ue.prototype.featuresVolumeControl=!0;ue.prototype.featuresMuteControl=!0;ue.prototype.featuresFullscreenResize=!1;ue.prototype.featuresPlaybackRate=!1;ue.prototype.featuresProgressEvents=!1;ue.prototype.featuresSourceset=!1;ue.prototype.featuresTimeupdateEvents=!1;ue.prototype.featuresNativeTextTracks=!1;ue.prototype.featuresVideoFrameCallback=!1;ue.withSourceHandlers=function(i){i.registerSourceHandler=function(t,r){let s=i.sourceHandlers;s||(s=i.sourceHandlers=[]),r===void 0&&(r=s.length),s.splice(r,0,t)},i.canPlayType=function(t){const r=i.sourceHandlers||[];let s;for(let n=0;n<r.length;n++)if(s=r[n].canPlayType(t),s)return s;return""},i.selectSourceHandler=function(t,r){const s=i.sourceHandlers||[];let n;for(let a=0;a<s.length;a++)if(n=s[a].canHandleSource(t,r),n)return s[a];return null},i.canPlaySource=function(t,r){const s=i.selectSourceHandler(t,r);return s?s.canHandleSource(t,r):""},["seekable","seeking","duration"].forEach(function(t){const r=this[t];typeof r=="function"&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):r.apply(this,arguments)})},i.prototype),i.prototype.setSource=function(t){let r=i.selectSourceHandler(t,this.options_);r||(i.nativeSourceHandler?r=i.nativeSourceHandler:fe.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),r!==i.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=r.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},i.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};H.registerComponent("Tech",ue);ue.registerTech("Tech",ue);ue.defaultTechOrder_=[];const nr={},fa={},pa={};function n1(i,e){nr[i]=nr[i]||[],nr[i].push(e)}function a1(i,e,t){i.setTimeout(()=>Zi(e,nr[e.type],t,i),1)}function o1(i,e){i.forEach(t=>t.setTech&&t.setTech(e))}function l1(i,e,t){return i.reduceRight(lu(t),e[t]())}function u1(i,e,t,r){return e[t](i.reduce(lu(t),r))}function wd(i,e,t,r=null){const s="call"+He(t),n=i.reduce(lu(s),r),a=n===pa,l=a?null:e[t](n);return h1(i,t,l,a),l}const c1={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},d1={setCurrentTime:1,setMuted:1,setVolume:1},Dd={play:1,pause:1};function lu(i){return(e,t)=>e===pa?pa:t[i]?t[i](e):e}function h1(i,e,t,r){for(let s=i.length-1;s>=0;s--){const n=i[s];n[e]&&n[e](r,t)}}function f1(i){fa.hasOwnProperty(i.id())&&delete fa[i.id()]}function p1(i,e){const t=fa[i.id()];let r=null;if(t==null)return r=e(i),fa[i.id()]=[[e,r]],r;for(let s=0;s<t.length;s++){const[n,a]=t[s];n===e&&(r=a)}return r===null&&(r=e(i),t.push([e,r])),r}function Zi(i={},e=[],t,r,s=[],n=!1){const[a,...l]=e;if(typeof a=="string")Zi(i,nr[a],t,r,s,n);else if(a){const u=p1(r,a);if(!u.setSource)return s.push(u),Zi(i,l,t,r,s,n);u.setSource(Object.assign({},i),function(f,p){if(f)return Zi(i,l,t,r,s,n);s.push(u),Zi(p,i.type===p.type?l:nr[p.type],t,r,s,n)})}else l.length?Zi(i,l,t,r,s,n):n?t(i,s):Zi(i,nr["*"],t,r,s,!0)}const m1={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},ma=function(i=""){const e=ou(i);return m1[e.toLowerCase()]||""},g1=(i,e)=>{if(!e)return"";if(i.cache_.source.src===e&&i.cache_.source.type)return i.cache_.source.type;const t=i.cache_.sources.filter(s=>s.src===e);if(t.length)return t[0].type;const r=i.$$("source");for(let s=0;s<r.length;s++){const n=r[s];if(n.type&&n.src&&n.src===e)return n.type}return ma(e)},Pp=function(i){if(Array.isArray(i)){let e=[];i.forEach(function(t){t=Pp(t),Array.isArray(t)?e=e.concat(t):di(t)&&e.push(t)}),i=e}else typeof i=="string"&&i.trim()?i=[Id({src:i})]:di(i)&&typeof i.src=="string"&&i.src&&i.src.trim()?i=[Id(i)]:i=[];return i};function Id(i){if(!i.type){const e=ma(i.src);e&&(i.type=e)}return i}var y1=`<svg xmlns="http://www.w3.org/2000/svg">
29
- <defs>
30
- <symbol viewBox="0 0 48 48" id="vjs-icon-play">
31
- <path d="M16 10v28l22-14z"></path>
32
- </symbol>
33
- <symbol viewBox="0 0 48 48" id="vjs-icon-pause">
34
- <path d="M12 38h8V10h-8v28zm16-28v28h8V10h-8z"></path>
35
- </symbol>
36
- <symbol viewBox="0 0 48 48" id="vjs-icon-audio">
37
- <path d="M24 2C14.06 2 6 10.06 6 20v14c0 3.31 2.69 6 6 6h6V24h-8v-4c0-7.73 6.27-14 14-14s14 6.27 14 14v4h-8v16h6c3.31 0 6-2.69 6-6V20c0-9.94-8.06-18-18-18z"></path>
38
- </symbol>
39
- <symbol viewBox="0 0 48 48" id="vjs-icon-captions">
40
- <path d="M38 8H10c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM22 22h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2zm14 0h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2z"></path>
41
- </symbol>
42
- <symbol viewBox="0 0 48 48" id="vjs-icon-subtitles">
43
- <path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"></path>
44
- </symbol>
45
- <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-enter">
46
- <path d="M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z"></path>
47
- </symbol>
48
- <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-exit">
49
- <path d="M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z"></path>
50
- </symbol>
51
- <symbol viewBox="0 0 48 48" id="vjs-icon-play-circle">
52
- <path d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
53
- </symbol>
54
- <symbol viewBox="0 0 48 48" id="vjs-icon-volume-mute">
55
- <path d="M33 24c0-3.53-2.04-6.58-5-8.05v4.42l4.91 4.91c.06-.42.09-.85.09-1.28zm5 0c0 1.88-.41 3.65-1.08 5.28l3.03 3.03C41.25 29.82 42 27 42 24c0-8.56-5.99-15.72-14-17.54v4.13c5.78 1.72 10 7.07 10 13.41zM8.55 6L6 8.55 15.45 18H6v12h8l10 10V26.55l8.51 8.51c-1.34 1.03-2.85 1.86-4.51 2.36v4.13a17.94 17.94 0 0 0 7.37-3.62L39.45 42 42 39.45l-18-18L8.55 6zM24 8l-4.18 4.18L24 16.36V8z"></path>
56
- </symbol>
57
- <symbol viewBox="0 0 48 48" id="vjs-icon-volume-low">
58
- <path d="M14 18v12h8l10 10V8L22 18h-8z"></path>
59
- </symbol>
60
- <symbol viewBox="0 0 48 48" id="vjs-icon-volume-medium">
61
- <path d="M37 24c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zm-27-6v12h8l10 10V8L18 18h-8z"></path>
62
- </symbol>
63
- <symbol viewBox="0 0 48 48" id="vjs-icon-volume-high">
64
- <path d="M6 18v12h8l10 10V8L14 18H6zm27 6c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zM28 6.46v4.13c5.78 1.72 10 7.07 10 13.41s-4.22 11.69-10 13.41v4.13c8.01-1.82 14-8.97 14-17.54S36.01 8.28 28 6.46z"></path>
65
- </symbol>
66
- <symbol viewBox="0 0 48 48" id="vjs-icon-spinner">
67
- <path d="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64 4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77 18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44 24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0 1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99 12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0 9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z"></path>
68
- </symbol>
69
- <symbol viewBox="0 0 24 24" id="vjs-icon-hd">
70
- <path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z"></path>
71
- </symbol>
72
- <symbol viewBox="0 0 48 48" id="vjs-icon-chapters">
73
- <path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z"></path>
74
- </symbol>
75
- <symbol viewBox="0 0 40 40" id="vjs-icon-downloading">
76
- <path d="M18.208 36.875q-3.208-.292-5.979-1.729-2.771-1.438-4.812-3.729-2.042-2.292-3.188-5.229-1.146-2.938-1.146-6.23 0-6.583 4.334-11.416 4.333-4.834 10.833-5.5v3.166q-5.167.75-8.583 4.646Q6.25 14.75 6.25 19.958q0 5.209 3.396 9.104 3.396 3.896 8.562 4.646zM20 28.417L11.542 20l2.083-2.083 4.917 4.916v-11.25h2.916v11.25l4.875-4.916L28.417 20zm1.792 8.458v-3.167q1.833-.25 3.541-.958 1.709-.708 3.167-1.875l2.333 2.292q-1.958 1.583-4.25 2.541-2.291.959-4.791 1.167zm6.791-27.792q-1.541-1.125-3.25-1.854-1.708-.729-3.541-1.021V3.042q2.5.25 4.77 1.208 2.271.958 4.271 2.5zm4.584 21.584l-2.25-2.25q1.166-1.5 1.854-3.209.687-1.708.937-3.541h3.209q-.292 2.5-1.229 4.791-.938 2.292-2.521 4.209zm.541-12.417q-.291-1.833-.958-3.562-.667-1.73-1.833-3.188l2.375-2.208q1.541 1.916 2.458 4.208.917 2.292 1.167 4.75z"></path>
77
- </symbol>
78
- <symbol viewBox="0 0 48 48" id="vjs-icon-file-download">
79
- <path d="M10.8 40.55q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h26.35v-7.7h3.4v7.7q0 1.4-1 2.4t-2.4 1zM24 32.1L13.9 22.05l2.45-2.45 5.95 5.95V7.15h3.4v18.4l5.95-5.95 2.45 2.45z"></path>
80
- </symbol>
81
- <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-done">
82
- <path d="M9.8 40.5v-3.45h28.4v3.45zm9.2-9.05L7.4 19.85l2.45-2.35L19 26.65l19.2-19.2 2.4 2.4z"></path>
83
- </symbol>
84
- <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-off">
85
- <path d="M4.9 4.75L43.25 43.1 41 45.3l-4.75-4.75q-.05.05-.075.025-.025-.025-.075-.025H10.8q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h22.05l-7-7-1.85 1.8L13.9 21.9l1.85-1.85L2.7 7zm26.75 14.7l2.45 2.45-3.75 3.8-2.45-2.5zM25.7 7.15V21.1l-3.4-3.45V7.15z"></path>
86
- </symbol>
87
- <symbol viewBox="0 0 48 48" id="vjs-icon-share">
88
- <path d="M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31A5.83 5.83 0 1 0 36 32.17z"></path>
89
- </symbol>
90
- <symbol viewBox="0 0 48 48" id="vjs-icon-cog">
91
- <path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 0 0-3.38 1.97L9.9 10.1a1 1 0 0 0-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 0 0 3.38-1.97l4.98 2.01a1 1 0 0 0 1.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path>
92
- </symbol>
93
- <symbol viewBox="0 0 48 48" id="vjs-icon-square">
94
- <path d="M36 8H12c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zm0 28H12V12h24v24z"></path>
95
- </symbol>
96
- <symbol viewBox="0 0 48 48" id="vjs-icon-circle">
97
- <circle cx="24" cy="24" r="20"></circle>
98
- </symbol>
99
- <symbol viewBox="0 0 48 48" id="vjs-icon-circle-outline">
100
- <path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>
101
- </symbol>
102
- <symbol viewBox="0 0 48 48" id="vjs-icon-circle-inner-circle">
103
- <path d="M24 4C12.97 4 4 12.97 4 24s8.97 20 20 20 20-8.97 20-20S35.03 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16zm6-16c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6 6 2.69 6 6z"></path>
104
- </symbol>
105
- <symbol viewBox="0 0 48 48" id="vjs-icon-cancel">
106
- <path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"></path>
107
- </symbol>
108
- <symbol viewBox="0 0 48 48" id="vjs-icon-replay">
109
- <path d="M24 10V2L14 12l10 10v-8c6.63 0 12 5.37 12 12s-5.37 12-12 12-12-5.37-12-12H8c0 8.84 7.16 16 16 16s16-7.16 16-16-7.16-16-16-16z"></path>
110
- </symbol>
111
- <symbol viewBox="0 0 48 48" id="vjs-icon-repeat">
112
- <path d="M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z"></path>
113
- </symbol>
114
- <symbol viewBox="0 96 48 48" id="vjs-icon-replay-5">
115
- <path d="M17.689 98l-8.697 8.696 8.697 8.697 2.486-2.485-4.32-4.319h1.302c4.93 0 9.071 1.722 12.424 5.165 3.352 3.443 5.029 7.638 5.029 12.584h3.55c0-2.958-.553-5.73-1.658-8.313-1.104-2.583-2.622-4.841-4.555-6.774-1.932-1.932-4.19-3.45-6.773-4.555-2.584-1.104-5.355-1.657-8.313-1.657H15.5l4.615-4.615zm-8.08 21.659v13.861h11.357v5.008H9.609V143h12.7c.834 0 1.55-.298 2.146-.894.596-.597.895-1.31.895-2.145v-7.781c0-.835-.299-1.55-.895-2.147a2.929 2.929 0 0 0-2.147-.894h-8.227v-5.096H25.35v-4.384z"></path>
116
- </symbol>
117
- <symbol viewBox="0 96 48 48" id="vjs-icon-replay-10">
118
- <path d="M42.315 125.63c0-4.997-1.694-9.235-5.08-12.713-3.388-3.479-7.571-5.218-12.552-5.218h-1.315l4.363 4.363-2.51 2.51-8.787-8.786L25.221 97l2.45 2.45-4.662 4.663h1.375c2.988 0 5.788.557 8.397 1.673 2.61 1.116 4.892 2.65 6.844 4.602 1.953 1.953 3.487 4.234 4.602 6.844 1.116 2.61 1.674 5.41 1.674 8.398zM8.183 142v-19.657H3.176V117.8h9.643V142zm13.63 0c-1.156 0-2.127-.393-2.912-1.178-.778-.778-1.168-1.746-1.168-2.902v-16.04c0-1.156.393-2.127 1.178-2.912.779-.779 1.746-1.168 2.902-1.168h7.696c1.156 0 2.126.392 2.911 1.177.779.78 1.168 1.747 1.168 2.903v16.04c0 1.156-.392 2.127-1.177 2.912-.779.779-1.746 1.168-2.902 1.168zm.556-4.636h6.583v-15.02H22.37z"></path>
119
- </symbol>
120
- <symbol viewBox="0 96 48 48" id="vjs-icon-replay-30">
121
- <path d="M26.047 97l-8.733 8.732 8.733 8.733 2.496-2.494-4.336-4.338h1.307c4.95 0 9.108 1.73 12.474 5.187 3.367 3.458 5.051 7.668 5.051 12.635h3.565c0-2.97-.556-5.751-1.665-8.346-1.109-2.594-2.633-4.862-4.574-6.802-1.94-1.941-4.208-3.466-6.803-4.575-2.594-1.109-5.375-1.664-8.345-1.664H23.85l4.634-4.634zM2.555 117.531v4.688h10.297v5.25H5.873v4.687h6.979v5.156H2.555V142H13.36c1.061 0 1.95-.395 2.668-1.186.718-.79 1.076-1.772 1.076-2.94v-16.218c0-1.168-.358-2.149-1.076-2.94-.717-.79-1.607-1.185-2.668-1.185zm22.482.14c-1.149 0-2.11.39-2.885 1.165-.78.78-1.172 1.744-1.172 2.893v15.943c0 1.149.388 2.11 1.163 2.885.78.78 1.745 1.172 2.894 1.172h7.649c1.148 0 2.11-.388 2.884-1.163.78-.78 1.17-1.745 1.17-2.894v-15.943c0-1.15-.386-2.111-1.16-2.885-.78-.78-1.746-1.172-2.894-1.172zm.553 4.518h6.545v14.93H25.59z"></path>
122
- </symbol>
123
- <symbol viewBox="0 96 48 48" id="vjs-icon-forward-5">
124
- <path d="M29.508 97l-2.431 2.43 4.625 4.625h-1.364c-2.965 0-5.742.554-8.332 1.66-2.589 1.107-4.851 2.629-6.788 4.566-1.937 1.937-3.458 4.2-4.565 6.788-1.107 2.59-1.66 5.367-1.66 8.331h3.557c0-4.957 1.68-9.16 5.04-12.611 3.36-3.45 7.51-5.177 12.451-5.177h1.304l-4.326 4.33 2.49 2.49 8.715-8.716zm-9.783 21.61v13.89h11.382v5.018H19.725V142h12.727a2.93 2.93 0 0 0 2.15-.896 2.93 2.93 0 0 0 .896-2.15v-7.798c0-.837-.299-1.554-.896-2.152a2.93 2.93 0 0 0-2.15-.896h-8.245V123h11.29v-4.392z"></path>
125
- </symbol>
126
- <symbol viewBox="0 96 48 48" id="vjs-icon-forward-10">
127
- <path d="M23.119 97l-2.386 2.383 4.538 4.538h-1.339c-2.908 0-5.633.543-8.173 1.63-2.54 1.085-4.76 2.577-6.66 4.478-1.9 1.9-3.392 4.12-4.478 6.66-1.085 2.54-1.629 5.264-1.629 8.172h3.49c0-4.863 1.648-8.986 4.944-12.372 3.297-3.385 7.368-5.078 12.216-5.078h1.279l-4.245 4.247 2.443 2.442 8.55-8.55zm-9.52 21.45v4.42h4.871V142h4.513v-23.55zm18.136 0c-1.125 0-2.066.377-2.824 1.135-.764.764-1.148 1.709-1.148 2.834v15.612c0 1.124.38 2.066 1.139 2.824.764.764 1.708 1.145 2.833 1.145h7.489c1.125 0 2.066-.378 2.824-1.136.764-.764 1.145-1.709 1.145-2.833v-15.612c0-1.125-.378-2.067-1.136-2.825-.764-.764-1.708-1.145-2.833-1.145zm.54 4.42h6.408v14.617h-6.407z"></path>
128
- </symbol>
129
- <symbol viewBox="0 96 48 48" id="vjs-icon-forward-30">
130
- <path d="M25.549 97l-2.437 2.434 4.634 4.635H26.38c-2.97 0-5.753.555-8.347 1.664-2.594 1.109-4.861 2.633-6.802 4.574-1.94 1.94-3.465 4.207-4.574 6.802-1.109 2.594-1.664 5.377-1.664 8.347h3.565c0-4.967 1.683-9.178 5.05-12.636 3.366-3.458 7.525-5.187 12.475-5.187h1.307l-4.335 4.338 2.495 2.494 8.732-8.732zm-11.553 20.53v4.689h10.297v5.249h-6.978v4.688h6.978v5.156H13.996V142h10.808c1.06 0 1.948-.395 2.666-1.186.718-.79 1.077-1.771 1.077-2.94v-16.217c0-1.169-.36-2.15-1.077-2.94-.718-.79-1.605-1.186-2.666-1.186zm21.174.168c-1.149 0-2.11.389-2.884 1.163-.78.78-1.172 1.745-1.172 2.894v15.942c0 1.15.388 2.11 1.162 2.885.78.78 1.745 1.17 2.894 1.17h7.649c1.149 0 2.11-.386 2.885-1.16.78-.78 1.17-1.746 1.17-2.895v-15.942c0-1.15-.387-2.11-1.161-2.885-.78-.78-1.745-1.172-2.894-1.172zm.552 4.516h6.542v14.931h-6.542z"></path>
131
- </symbol>
132
- <symbol viewBox="0 0 512 512" id="vjs-icon-audio-description">
133
- <g fill-rule="evenodd"><path d="M227.29 381.351V162.993c50.38-1.017 89.108-3.028 117.631 17.126 27.374 19.342 48.734 56.965 44.89 105.325-4.067 51.155-41.335 94.139-89.776 98.475-24.085 2.155-71.972 0-71.972 0s-.84-1.352-.773-2.568m48.755-54.804c31.43 1.26 53.208-16.633 56.495-45.386 4.403-38.51-21.188-63.552-58.041-60.796v103.612c-.036 1.466.575 2.22 1.546 2.57"></path><path d="M383.78 381.328c13.336 3.71 17.387-11.06 23.215-21.408 12.722-22.571 22.294-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.226 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M425.154 381.328c13.336 3.71 17.384-11.061 23.215-21.408 12.721-22.571 22.291-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.511c-.586 3.874 2.226 7.315 3.866 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M466.26 381.328c13.337 3.71 17.385-11.061 23.216-21.408 12.722-22.571 22.292-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.225 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894M4.477 383.005H72.58l18.573-28.484 64.169-.135s.065 19.413.065 28.62h48.756V160.307h-58.816c-5.653 9.537-140.85 222.697-140.85 222.697zm152.667-145.282v71.158l-40.453-.27 40.453-70.888z"></path></g>
134
- </symbol>
135
- <symbol viewBox="0 0 48 48" id="vjs-icon-next-item">
136
- <path d="M12 36l17-12-17-12v24zm20-24v24h4V12h-4z"></path>
137
- </symbol>
138
- <symbol viewBox="0 0 48 48" id="vjs-icon-previous-item">
139
- <path d="M12 12h4v24h-4zm7 12l17 12V12z"></path>
140
- </symbol>
141
- <symbol viewBox="0 0 48 48" id="vjs-icon-shuffle">
142
- <path d="M21.17 18.34L10.83 8 8 10.83l10.34 10.34 2.83-2.83zM29 8l4.09 4.09L8 37.17 10.83 40l25.09-25.09L40 19V8H29zm.66 18.83l-2.83 2.83 6.26 6.26L29 40h11V29l-4.09 4.09-6.25-6.26z"></path>
143
- </symbol>
144
- <symbol viewBox="0 0 48 48" id="vjs-icon-cast">
145
- <path d="M42 6H6c-2.21 0-4 1.79-4 4v6h4v-6h36v28H28v4h14c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM2 36v6h6c0-3.31-2.69-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.73-6.27-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.15-9.85-22-22-22z"></path>
146
- </symbol>
147
- <symbol viewBox="0 0 48 48" id="vjs-icon-picture-in-picture-enter">
148
- <path d="M38 22H22v11.99h16V22zm8 16V9.96C46 7.76 44.2 6 42 6H6C3.8 6 2 7.76 2 9.96V38c0 2.2 1.8 4 4 4h36c2.2 0 4-1.8 4-4zm-4 .04H6V9.94h36v28.1z"></path>
149
- </symbol>
150
- <symbol viewBox="0 0 22 18" id="vjs-icon-picture-in-picture-exit">
151
- <path d="M18 4H4v10h14V4zm4 12V1.98C22 .88 21.1 0 20 0H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H2V1.97h18v14.05z"></path>
152
- <path fill="none" d="M-1-3h24v24H-1z"></path>
153
- </symbol>
154
- <symbol viewBox="0 0 1792 1792" id="vjs-icon-facebook">
155
- <path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z"></path>
156
- </symbol>
157
- <symbol viewBox="0 0 1792 1792" id="vjs-icon-linkedin">
158
- <path d="M477 625v991H147V625h330zm21-306q1 73-50.5 122T312 490h-2q-82 0-132-49t-50-122q0-74 51.5-122.5T314 148t133 48.5T498 319zm1166 729v568h-329v-530q0-105-40.5-164.5T1168 862q-63 0-105.5 34.5T999 982q-11 30-11 81v553H659q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5T1285 602q171 0 275 113.5t104 332.5z"></path>
159
- </symbol>
160
- <symbol viewBox="0 0 1200 1227" id="vjs-icon-twitter">
161
- <path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z"/>
162
- </symbol>
163
- <symbol viewBox="0 0 1792 1792" id="vjs-icon-tumblr">
164
- <path d="M1328 1329l80 237q-23 35-111 66t-177 32q-104 2-190.5-26T787 1564t-95-106-55.5-120-16.5-118V676H452V461q72-26 129-69.5t91-90 58-102 34-99T779 12q1-5 4.5-8.5T791 0h244v424h333v252h-334v518q0 30 6.5 56t22.5 52.5 49.5 41.5 81.5 14q78-2 134-29z"></path>
165
- </symbol>
166
- <symbol viewBox="0 0 1792 1792" id="vjs-icon-pinterest">
167
- <path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>
168
- </symbol>
169
- </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_,`
172
- .${s} {
173
- width: ${e}px;
174
- height: ${t}px;
175
- }
176
-
177
- .${s}.vjs-fluid:not(.vjs-audio-only-mode) {
178
- padding-top: ${a*100}%;
179
- }
180
- `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const r=He(e),s=e.charAt(0).toLowerCase()+e.slice(1);r!=="Html5"&&this.tag&&(ue.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=r,this.isReady_=!1;let n=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(n=!1);const a={source:t,autoplay:n,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};dt.names.forEach(u=>{const f=dt[u];a[f.getterName]=this[f.privateName]}),Object.assign(a,this.options_[r]),Object.assign(a,this.options_[s]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const l=ue.getTech(e);if(!l)throw new Error(`No Tech named '${r}' exists! '${r}' should be registered using videojs.registerTech()'`);this.tech_=new l(a),this.tech_.ready(Pe(this,this.handleTechReady_),!0),Sd.jsonToTextTracks(this.textTracksJson_||[],this.tech_),om.forEach(u=>{this.on(this.tech_,u,f=>this[`handleTech${He(u)}_`](f))}),Object.keys(Vo).forEach(u=>{this.on(this.tech_,u,f=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Vo[u]}_`].bind(this),event:f});return}this[`handleTech${Vo[u]}_`](f)})}),this.on(this.tech_,"loadstart",u=>this.handleTechLoadStart_(u)),this.on(this.tech_,"sourceset",u=>this.handleTechSourceset_(u)),this.on(this.tech_,"waiting",u=>this.handleTechWaiting_(u)),this.on(this.tech_,"ended",u=>this.handleTechEnded_(u)),this.on(this.tech_,"seeking",u=>this.handleTechSeeking_(u)),this.on(this.tech_,"play",u=>this.handleTechPlay_(u)),this.on(this.tech_,"pause",u=>this.handleTechPause_(u)),this.on(this.tech_,"durationchange",u=>this.handleTechDurationChange_(u)),this.on(this.tech_,"fullscreenchange",(u,f)=>this.handleTechFullscreenChange_(u,f)),this.on(this.tech_,"fullscreenerror",(u,f)=>this.handleTechFullscreenError_(u,f)),this.on(this.tech_,"enterpictureinpicture",u=>this.handleTechEnterPictureInPicture_(u)),this.on(this.tech_,"leavepictureinpicture",u=>this.handleTechLeavePictureInPicture_(u)),this.on(this.tech_,"error",u=>this.handleTechError_(u)),this.on(this.tech_,"posterchange",u=>this.handleTechPosterChange_(u)),this.on(this.tech_,"textdata",u=>this.handleTechTextData_(u)),this.on(this.tech_,"ratechange",u=>this.handleTechRateChange_(u)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(r!=="Html5"||!this.tag)&&rl(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){dt.names.forEach(e=>{const t=dt[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Sd.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&fe.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
181
- 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,`
183
- .video-js {
184
- width: 300px;
185
- height: 150px;
186
- }
187
-
188
- .vjs-fluid:not(.vjs-audio-only-mode) {
189
- padding-top: 56.25%
190
- }
191
- `)}}nl(1,F);F.VERSION=tl;F.options=Oe.prototype.options_;F.getPlayers=()=>Oe.players;F.getPlayer=i=>{const e=Oe.players;let t;if(typeof i=="string"){const r=um(i),s=e[r];if(s)return s;t=Vi("#"+r)}else t=i;if(Zr(t)){const{player:r,playerId:s}=t;if(r||e[s])return r||e[s]}};F.getAllPlayers=()=>Object.keys(Oe.players).map(i=>Oe.players[i]).filter(Boolean);F.players=Oe.players;F.getComponent=H.getComponent;F.registerComponent=(i,e)=>(ue.isTech(e)&&fe.warn(`The ${i} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),H.registerComponent.call(H,i,e));F.getTech=ue.getTech;F.registerTech=ue.registerTech;F.use=n1;Object.defineProperty(F,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(F.middleware,"TERMINATOR",{value:pa,writeable:!1,enumerable:!0});F.browser=tp;F.obj=R2;F.mergeOptions=Kt(9,"videojs.mergeOptions","videojs.obj.merge",Ae);F.defineLazyProperty=Kt(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Ua);F.bind=Kt(9,"videojs.bind","native Function.prototype.bind",Pe);F.registerPlugin=vt.registerPlugin;F.deregisterPlugin=vt.deregisterPlugin;F.plugin=(i,e)=>(fe.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),vt.registerPlugin(i,e));F.getPlugins=vt.getPlugins;F.getPlugin=vt.getPlugin;F.getPluginVersion=vt.getPluginVersion;F.addLanguage=function(i,e){return i=(""+i).toLowerCase(),F.options.languages=Ae(F.options.languages,{[i]:e}),F.options.languages[i]};F.log=fe;F.createLogger=Gf;F.time=K2;F.createTimeRange=Kt(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Wt);F.createTimeRanges=Kt(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Wt);F.formatTime=Kt(9,"videojs.formatTime","videojs.time.formatTime",ur);F.setFormatTime=Kt(9,"videojs.setFormatTime","videojs.time.setFormatTime",Ep);F.resetFormatTime=Kt(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Cp);F.parseUrl=Kt(9,"videojs.parseUrl","videojs.url.parseUrl",au);F.isCrossOrigin=Kt(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Ya);F.EventTarget=kt;F.any=iu;F.on=It;F.one=Ka;F.off=nt;F.trigger=es;F.xhr=Wh;F.TextTrack=ln;F.AudioTrack=Ip;F.VideoTrack=kp;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(i=>{F[i]=function(){return fe.warn(`videojs.${i}() is deprecated; use videojs.dom.${i}() instead`),pp[i].apply(null,arguments)}});F.computedStyle=Kt(9,"videojs.computedStyle","videojs.dom.computedStyle",Kr);F.dom=pp;F.fn=V2;F.num=A1;F.str=W2;F.url=r1;F.Error=Q1;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class J1{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(r){t.enabled_(r)}}),t}}class Ta extends F.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const r=this.levels_.length;return t=new J1(e),""+r in this||Object.defineProperty(this,r,{get(){return this.levels_[r]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let r=0,s=this.length;r<s;r++)if(this[r]===e){t=this.levels_.splice(r,1)[0],this.selectedIndex_===r?this.selectedIndex_=-1:this.selectedIndex_>r&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,r=this.length;t<r;t++){const s=this[t];if(s.id===e)return s}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}Ta.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const i in Ta.prototype.allowedEvents_)Ta.prototype["on"+i]=null;var cm="4.1.0";const Z1=function(i,e){const t=i.qualityLevels,r=new Ta,s=function(){r.dispose(),i.qualityLevels=t,i.off("dispose",s)};return i.on("dispose",s),i.qualityLevels=()=>r,i.qualityLevels.VERSION=cm,r},dm=function(i){return Z1(this,F.obj.merge({},i))};F.registerPlugin("qualityLevels",dm);dm.VERSION=cm;/*! @name @videojs/http-streaming @version 3.16.2 @license Apache-2.0 */const _t=ka,va=(i,e)=>e&&e.responseURL&&i!==e.responseURL?e.responseURL:i,$t=i=>F.log.debug?F.log.debug.bind(F,"VHS:",`${i} >`):function(){};function Te(...i){const e=F.obj||F;return(e.merge||e.mergeOptions).apply(e,i)}function et(...i){const e=F.time||F;return(e.createTimeRanges||e.createTimeRanges).apply(e,i)}function ex(i){if(i.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
192
- `;for(let t=0;t<i.length;t++){const r=i.start(t),s=i.end(t);e+=`${r} --> ${s}. Duration (${s-r})
193
- `}return e}const ni=1/30,ai=ni*3,hm=function(i,e){const t=[];let r;if(i&&i.length)for(r=0;r<i.length;r++)e(i.start(r),i.end(r))&&t.push([i.start(r),i.end(r)]);return et(t)},Dr=function(i,e){return hm(i,function(t,r){return t-ai<=e&&r+ai>=e})},zn=function(i,e){return hm(i,function(t){return t-ni>=e})},tx=function(i){if(i.length<2)return et();const e=[];for(let t=1;t<i.length;t++){const r=i.end(t-1),s=i.start(t);e.push([r,s])}return et(e)},ix=function(i,e){let t=null,r=null,s=0;const n=[],a=[];if(!i||!i.length||!e||!e.length)return et();let l=i.length;for(;l--;)n.push({time:i.start(l),type:"start"}),n.push({time:i.end(l),type:"end"});for(l=e.length;l--;)n.push({time:e.start(l),type:"start"}),n.push({time:e.end(l),type:"end"});for(n.sort(function(u,f){return u.time-f.time}),l=0;l<n.length;l++)n[l].type==="start"?(s++,s===2&&(t=n[l].time)):n[l].type==="end"&&(s--,s===1&&(r=n[l].time)),t!==null&&r!==null&&(a.push([t,r]),t=null,r=null);return et(a)},fm=i=>{const e=[];if(!i||!i.length)return"";for(let t=0;t<i.length;t++)e.push(i.start(t)+" => "+i.end(t));return e.join(", ")},rx=function(i,e,t=1){return((i.length?i.end(i.length-1):0)-e)/t},ir=i=>{const e=[];for(let t=0;t<i.length;t++)e.push({start:i.start(t),end:i.end(t)});return e},sx=function(i,e){if(i===e)return!1;if(!i&&e||!e&&i||i.length!==e.length)return!0;for(let t=0;t<i.length;t++)if(i.start(t)!==e.start(t)||i.end(t)!==e.end(t))return!0;return!1},qo=function(i){if(!(!i||!i.length||!i.end))return i.end(i.length-1)},Su=function(i,e){let t=0;if(!i||!i.length)return t;for(let r=0;r<i.length;r++){const s=i.start(r),n=i.end(r);if(!(e>n)){if(e>s&&e<=n){t+=n-e;continue}t+=n-s}}return t},Eu=(i,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(r){t+=r.duration}),(e.preloadHints||[]).forEach(function(r){r.type==="PART"&&(t+=i.partTargetDuration)}),t},hl=i=>(i.segments||[]).reduce((e,t,r)=>(t.parts?t.parts.forEach(function(s,n){e.push({duration:s.duration,segmentIndex:r,partIndex:n,part:s,segment:t})}):e.push({duration:t.duration,segmentIndex:r,partIndex:null,segment:t,part:null}),e),[]),pm=i=>{const e=i.segments&&i.segments.length&&i.segments[i.segments.length-1];return e&&e.parts||[]},mm=({preloadSegment:i})=>{if(!i)return;const{parts:e,preloadHints:t}=i;let r=(t||[]).reduce((s,n)=>s+(n.type==="PART"?1:0),0);return r+=e&&e.length?e.length:0,r},gm=(i,e)=>{if(e.endList)return 0;if(i&&i.suggestedPresentationDelay)return i.suggestedPresentationDelay;const t=pm(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},nx=function(i,e){let t=0,r=e-i.mediaSequence,s=i.segments[r];if(s){if(typeof s.start<"u")return{result:s.start,precise:!0};if(typeof s.end<"u")return{result:s.end-s.duration,precise:!0}}for(;r--;){if(s=i.segments[r],typeof s.end<"u")return{result:t+s.end,precise:!0};if(t+=Eu(i,s),typeof s.start<"u")return{result:t+s.start,precise:!0}}return{result:t,precise:!1}},ax=function(i,e){let t=0,r,s=e-i.mediaSequence;for(;s<i.segments.length;s++){if(r=i.segments[s],typeof r.start<"u")return{result:r.start-t,precise:!0};if(t+=Eu(i,r),typeof r.end<"u")return{result:r.end-t,precise:!0}}return{result:-1,precise:!1}},ym=function(i,e,t){if(typeof e>"u"&&(e=i.mediaSequence+i.segments.length),e<i.mediaSequence)return 0;const r=nx(i,e);if(r.precise)return r.result;const s=ax(i,e);return s.precise?s.result:r.result+t},_m=function(i,e,t){if(!i)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(i.totalDuration)return i.totalDuration;if(!i.endList)return k.Infinity}return ym(i,e,t)},zs=function({defaultDuration:i,durationList:e,startIndex:t,endIndex:r}){let s=0;if(t>r&&([t,r]=[r,t]),t<0){for(let n=t;n<Math.min(0,r);n++)s+=i;t=0}for(let n=t;n<r;n++)s+=e[n].duration;return s},Tm=function(i,e,t,r){if(!i||!i.segments)return null;if(i.endList)return _m(i);if(e===null)return null;e=e||0;let s=ym(i,i.mediaSequence+i.segments.length,e);return t&&(r=typeof r=="number"?r:gm(null,i),s-=r),Math.max(0,s)},ox=function(i,e,t){const s=e||0;let n=Tm(i,e,!0,t);return n===null?et():(n<s&&(n=s),et(s,n))},lx=function({playlist:i,currentTime:e,startingSegmentIndex:t,startingPartIndex:r,startTime:s,exactManifestTimings:n}){let a=e-s;const l=hl(i);let u=0;for(let f=0;f<l.length;f++){const p=l[f];if(t===p.segmentIndex&&!(typeof r=="number"&&typeof p.partIndex=="number"&&r!==p.partIndex)){u=f;break}}if(a<0){if(u>0)for(let f=u-1;f>=0;f--){const p=l[f];if(a+=p.duration,n){if(a<0)continue}else if(a+ni<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:s-zs({defaultDuration:i.targetDuration,durationList:l,startIndex:u,endIndex:f})}}return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e}}if(u<0){for(let f=u;f<0;f++)if(a-=i.targetDuration,a<0)return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e};u=0}for(let f=u;f<l.length;f++){const p=l[f];a-=p.duration;const T=p.duration>ni,b=a===0,S=T&&a+ni>=0;if(!((b||S)&&f!==l.length-1)){if(n){if(a>0)continue}else if(a-ni>=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:s+zs({defaultDuration:i.targetDuration,durationList:l,startIndex:u,endIndex:f})}}}return{segmentIndex:l[l.length-1].segmentIndex,partIndex:l[l.length-1].partIndex,startTime:e}},vm=function(i){return i.excludeUntil&&i.excludeUntil>Date.now()},Cu=function(i){return i.excludeUntil&&i.excludeUntil===1/0},eo=function(i){const e=vm(i);return!i.disabled&&!e},ux=function(i){return i.disabled},cx=function(i){for(let e=0;e<i.segments.length;e++)if(i.segments[e].key)return!0;return!1},bm=function(i,e){return e.attributes&&e.attributes[i]},dx=function(i,e,t,r=0){return bm("BANDWIDTH",t)?(i*t.attributes.BANDWIDTH-r*8)/e:NaN},fl=(i,e)=>{if(i.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return i.playlists.filter(r=>eo(r)?(r.attributes.BANDWIDTH||0)<t:!1).length===0},Au=(i,e)=>!i&&!e||!i&&e||i&&!e?!1:!!(i===e||i.id&&e.id&&i.id===e.id||i.resolvedUri&&e.resolvedUri&&i.resolvedUri===e.resolvedUri||i.uri&&e.uri&&i.uri===e.uri),Wd=function(i,e){const t=i&&i.mediaGroups&&i.mediaGroups.AUDIO||{};let r=!1;for(const s in t){for(const n in t[s])if(r=e(t[s][n]),r)break;if(r)break}return!!r},hn=i=>{if(!i||!i.playlists||!i.playlists.length)return Wd(i,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;e<i.playlists.length;e++){const t=i.playlists[e],r=t.attributes&&t.attributes.CODECS;if(!(r&&r.split(",").every(n=>ef(n))||Wd(i,n=>Au(t,n))))return!1}return!0};var Tt={liveEdgeDelay:gm,duration:_m,seekable:ox,getMediaInfoForTime:lx,isEnabled:eo,isDisabled:ux,isExcluded:vm,isIncompatible:Cu,playlistEnd:Tm,isAes:cx,hasAttribute:bm,estimateSegmentRequestTime:dx,isLowestEnabledRendition:fl,isAudioOnly:hn,playlistMatch:Au,segmentDurationWithParts:Eu};const{log:xm}=F,Or=(i,e)=>`${i}-${e}`,Sm=(i,e,t)=>`placeholder-uri-${i}-${e}-${t}`,hx=({onwarn:i,oninfo:e,manifestString:t,customTagParsers:r=[],customTagMappers:s=[],llhls:n})=>{const a=new Dv;i&&a.on("warn",i),e&&a.on("info",e),r.forEach(f=>a.addParser(f)),s.forEach(f=>a.addTagMapper(f)),a.push(t),a.end();const l=a.manifest;if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(f){l.hasOwnProperty(f)&&delete l[f]}),l.segments&&l.segments.forEach(function(f){["parts","preloadHints"].forEach(function(p){f.hasOwnProperty(p)&&delete f[p]})})),!l.targetDuration){let f=10;l.segments&&l.segments.length&&(f=l.segments.reduce((p,T)=>Math.max(p,T.duration),0)),i&&i({message:`manifest has no targetDuration defaulting to ${f}`}),l.targetDuration=f}const u=pm(l);if(u.length&&!l.partTargetDuration){const f=u.reduce((p,T)=>Math.max(p,T.duration),0);i&&(i({message:`manifest has no partTargetDuration defaulting to ${f}`}),xm.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),l.partTargetDuration=f}return l},ss=(i,e)=>{i.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(i.mediaGroups[t])for(const r in i.mediaGroups[t])for(const s in i.mediaGroups[t][r]){const n=i.mediaGroups[t][r][s];e(n,t,r,s)}})},Em=({playlist:i,uri:e,id:t})=>{i.id=t,i.playlistErrors_=0,e&&(i.uri=e),i.attributes=i.attributes||{}},fx=i=>{let e=i.playlists.length;for(;e--;){const t=i.playlists[e];Em({playlist:t,id:Or(e,t.uri)}),t.resolvedUri=_t(i.uri,t.uri),i.playlists[t.id]=t,i.playlists[t.uri]=t,t.attributes.BANDWIDTH||xm.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},px=i=>{ss(i,e=>{e.uri&&(e.resolvedUri=_t(i.uri,e.uri))})},mx=(i,e)=>{const t=Or(0,e),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:k.location.href,resolvedUri:k.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return r.playlists[t]=r.playlists[0],r.playlists[e]=r.playlists[0],r},Cm=(i,e,t=Sm)=>{i.uri=e;for(let s=0;s<i.playlists.length;s++)if(!i.playlists[s].uri){const n=`placeholder-uri-${s}`;i.playlists[s].uri=n}const r=hn(i);ss(i,(s,n,a,l)=>{if(!s.playlists||!s.playlists.length){if(r&&n==="AUDIO"&&!s.uri)for(let u=0;u<i.playlists.length;u++){const f=i.playlists[u];if(f.attributes&&f.attributes.AUDIO&&f.attributes.AUDIO===a)return}s.playlists=[Ke({},s)]}s.playlists.forEach(function(u,f){const p=t(n,a,l,u),T=Or(f,p);u.uri?u.resolvedUri=u.resolvedUri||_t(i.uri,u.uri):(u.uri=f===0?p:T,u.resolvedUri=u.uri),u.id=u.id||T,u.attributes=u.attributes||{},i.playlists[u.id]=u,i.playlists[u.uri]=u})}),fx(i),px(i)};class Gd{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null||!e.length)return;const[t]=e;t.programDateTime!==void 0&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,r=t.startDate.getTime();this.trimProcessedDateRanges_(r),this.pendingDateRanges_=e.reduce((s,n)=>(s.set(n.id,n),s),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((r,s)=>{if(!this.processedDateRanges_.has(s)&&(r.startTime=r.startDate.getTime()/1e3-this.offset_,r.processDateRange=()=>this.processDateRange(r),t.push(r),!!r.class))if(e[r.class]){const n=e[r.class].push(r);r.classListIndex=n-1}else e[r.class]=[r],r.classListIndex=0});for(const r of t){const s=e[r.class]||[];r.endDate?r.endTime=r.endDate.getTime()/1e3-this.offset_:r.endOnNext&&s[r.classListIndex+1]?r.endTime=s[r.classListIndex+1].startTime:r.duration?r.endTime=r.startTime+r.duration:r.plannedDuration?r.endTime=r.startTime+r.plannedDuration:r.endTime=r.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((r,s)=>{r.startDate.getTime()<e&&this.processedDateRanges_.delete(s)})}}const Am=22,or=({requestType:i,request:e,error:t,parseFailure:r})=>{const s=e.status<200||e.status>299,n=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:i},l=s&&!n||r;if(t&&n)a.error=Ke({},t),a.errorType=F.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=F.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=F.Error.NetworkRequestTimeout;else if(l){const u=r?F.Error.NetworkBodyParserFailed:F.Error.NetworkBadStatus;a.errorType=u,a.status=e.status,a.headers=e.headers}return a},{EventTarget:gx}=F,yx=(i,e)=>{if(e.endList||!e.serverControl)return i;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:r}=e;let s=e.mediaSequence+e.segments.length;if(r){const n=r.parts||[],a=mm(e)-1;a>-1&&a!==n.length-1&&(t._HLS_part=a),(a>-1||n.length)&&s--}t._HLS_msn=s}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const r=new k.URL(i);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(s){t.hasOwnProperty(s)&&r.searchParams.set(s,t[s])}),i=r.toString()}return i},_x=(i,e)=>{if(!i)return e;const t=Te(i,e);if(i.preloadHints&&!e.preloadHints&&delete t.preloadHints,i.parts&&!e.parts)delete t.parts;else if(i.parts&&e.parts)for(let r=0;r<e.parts.length;r++)i.parts&&i.parts[r]&&(t.parts[r]=Te(i.parts[r],e.parts[r]));return!i.skipped&&e.skipped&&(t.skipped=!1),i.preload&&!e.preload&&(t.preload=!1),t},Tx=(i,e,t)=>{const r=i.slice(),s=e.slice();t=t||0;const n=[];let a;for(let l=0;l<s.length;l++){const u=r[l+t],f=s[l];u?(a=u.map||a,n.push(_x(u,f))):(a&&!f.map&&(f.map=a),n.push(f))}return n},wm=(i,e)=>{!i.resolvedUri&&i.uri&&(i.resolvedUri=_t(e,i.uri)),i.key&&!i.key.resolvedUri&&(i.key.resolvedUri=_t(e,i.key.uri)),i.map&&!i.map.resolvedUri&&(i.map.resolvedUri=_t(e,i.map.uri)),i.map&&i.map.key&&!i.map.key.resolvedUri&&(i.map.key.resolvedUri=_t(e,i.map.key.uri)),i.parts&&i.parts.length&&i.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=_t(e,t.uri))}),i.preloadHints&&i.preloadHints.length&&i.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=_t(e,t.uri))})},Dm=function(i){const e=i.segments||[],t=i.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let r=0;r<t.preloadHints.length;r++)if(t.preloadHints[r].type==="MAP")return e}t.duration=i.targetDuration,t.preload=!0,e.push(t)}return e},Im=(i,e)=>i===e||i.segments&&e.segments&&i.segments.length===e.segments.length&&i.endList===e.endList&&i.mediaSequence===e.mediaSequence&&i.preloadSegment===e.preloadSegment,pl=(i,e,t=Im)=>{const r=Te(i,{}),s=r.playlists[e.id];if(!s||t(s,e))return null;e.segments=Dm(e);const n=Te(s,e);if(n.preloadSegment&&!e.preloadSegment&&delete n.preloadSegment,s.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}n.segments=Tx(s.segments,e.segments,e.mediaSequence-s.mediaSequence)}n.segments.forEach(a=>{wm(a,n.resolvedUri)});for(let a=0;a<r.playlists.length;a++)r.playlists[a].id===e.id&&(r.playlists[a]=n);return r.playlists[e.id]=n,r.playlists[e.uri]=n,ss(i,(a,l,u,f)=>{if(a.playlists)for(let p=0;p<a.playlists.length;p++)e.id===a.playlists[p].id&&(a.playlists[p]=n)}),r},ml=(i,e)=>{const t=i.segments||[],r=t[t.length-1],s=r&&r.parts&&r.parts[r.parts.length-1],n=s&&s.duration||r&&r.duration;return e&&n?n*1e3:(i.partTargetDuration||i.targetDuration||10)*500},Kd=(i,e,t)=>{if(!i)return;const r=[];return i.forEach(s=>{if(!s.attributes)return;const{BANDWIDTH:n,RESOLUTION:a,CODECS:l}=s.attributes;r.push({id:s.id,bandwidth:n,resolution:a,codecs:l})}),{type:e,isLive:t,renditions:r}};class Ir extends gx{constructor(e,t,r={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=$t("PlaylistLoader");const{withCredentials:s=!1}=r;this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;const n=t.options_;this.customTagParsers=n&&n.customTagParsers||[],this.customTagMappers=n&&n.customTagMappers||[],this.llhls=n&&n.llhls,this.dateRangesStorage_=new Gd,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=_t(this.main.uri,e.uri);this.llhls&&(t=yx(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(r,s)=>{if(this.request){if(r)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,r){const{uri:s,id:n}=t;this.request=null,r&&(this.state=r),this.error={playlist:this.main.playlists[n],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:or({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return hx({onwarn:({message:r})=>this.logger_(`m3u8-parser warn for ${e}: ${r}`),oninfo:({message:r})=>this.logger_(`m3u8-parser info for ${e}: ${r}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(r){this.error=r,this.error.metadata={errorType:F.Error.StreamingHlsPlaylistParserError,error:r}}}haveMetadata({playlistString:e,playlistObject:t,url:r,id:s}){this.request=null,this.state="HAVE_METADATA";const n={playlistInfo:{type:"media",uri:r}};this.trigger({type:"playlistparsestart",metadata:n});const a=t||this.parseManifest_({url:r,manifestString:e});a.lastRequest=Date.now(),Em({playlist:a,uri:r,id:s});const l=pl(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,l?(this.main=l,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(ml(this.media(),!!l)),n.parsedPlaylist=Kd(this.main.playlists,n.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:n}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),k.clearTimeout(this.mediaUpdateTimeout),k.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Gd,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(k.clearTimeout(this.finalRenditionTimeout),t){const l=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=k.setTimeout(this.media.bind(this,e,!1),l);return}const r=this.state,s=!this.media_||e.id!==this.media_.id,n=this.main.playlists[e.id];if(n&&n.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,s&&(this.trigger("mediachanging"),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(ml(e,!0)),!s)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(l,u)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=va(e.resolvedUri,u),l)return this.playlistRequestError(this.request,e,r);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:u.responseText,url:e.uri,id:e.id}),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const r=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=k.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},r);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=k.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=k.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,r)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:r.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:r.responseText,code:2,metadata:or({requestType:r.requestType,request:r,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=va(this.src,r),this.trigger({type:"playlistparsestart",metadata:e});const s=this.parseManifest_({manifestString:r.responseText,url:this.src});e.parsedPlaylist=Kd(s.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(s)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,Cm(this.main,this.srcUri()),e.playlists.forEach(r=>{r.segments=Dm(r),r.segments.forEach(s=>{wm(s,r.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||k.location.href;this.main=mx(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const r=this.main,s=e.ID;let n=r.playlists.length;for(;n--;){const a=r.playlists[n];if(a.attributes["PATHWAY-ID"]===s){const l=a.resolvedUri,u=a.id;if(t){const f=this.createCloneURI_(a.resolvedUri,e),p=Or(s,f),T=this.createCloneAttributes_(s,a.attributes),b=this.createClonePlaylist_(a,p,e,T);r.playlists[n]=b,r.playlists[p]=b,r.playlists[f]=b}else r.playlists.splice(n,1);delete r.playlists[u],delete r.playlists[l]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const r=this.main,s=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!r.mediaGroups[n]||!r.mediaGroups[n][s])){for(const a in r.mediaGroups[n])if(a===s){for(const l in r.mediaGroups[n][a])r.mediaGroups[n][a][l].playlists.forEach((f,p)=>{const T=r.playlists[f.id],b=T.id,S=T.resolvedUri;delete r.playlists[b],delete r.playlists[S]});delete r.mediaGroups[n][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const r=this.main,s=r.playlists.length,n=this.createCloneURI_(t.resolvedUri,e),a=Or(e.ID,n),l=this.createCloneAttributes_(e.ID,t.attributes),u=this.createClonePlaylist_(t,a,e,l);r.playlists[s]=u,r.playlists[a]=u,r.playlists[n]=u,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,r=e["BASE-ID"],s=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!s.mediaGroups[n]||s.mediaGroups[n][t]))for(const a in s.mediaGroups[n]){if(a===r)s.mediaGroups[n][t]={};else continue;for(const l in s.mediaGroups[n][a]){const u=s.mediaGroups[n][a][l];s.mediaGroups[n][t][l]=Ke({},u);const f=s.mediaGroups[n][t][l],p=this.createCloneURI_(u.resolvedUri,e);f.resolvedUri=p,f.uri=p,f.playlists=[],u.playlists.forEach((T,b)=>{const S=s.playlists[T.id],A=Sm(n,t,l),v=Or(t,A);if(S&&!s.playlists[v]){const L=this.createClonePlaylist_(S,v,e),P=L.resolvedUri;s.playlists[v]=L,s.playlists[P]=L}f.playlists[b]=this.createClonePlaylist_(T,v,e)})}}})}createClonePlaylist_(e,t,r,s){const n=this.createCloneURI_(e.resolvedUri,r),a={resolvedUri:n,uri:n,id:t};return e.segments&&(a.segments=[]),s&&(a.attributes=s),Te(e,a)}createCloneURI_(e,t){const r=new URL(e);r.hostname=t["URI-REPLACEMENT"].HOST;const s=t["URI-REPLACEMENT"].PARAMS;for(const n of Object.keys(s))r.searchParams.set(n,s[n]);return r.href}createCloneAttributes_(e,t){const r={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{t[s]&&(r[s]=e)}),r}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const r in e.contentProtection){const s=e.contentProtection[r].attributes.keyId;s&&t.add(s.toLowerCase())}return t}}}const gl=function(i,e,t,r){const s=i.responseType==="arraybuffer"?i.response:i.responseText;!e&&s&&(i.responseTime=Date.now(),i.roundTripTime=i.responseTime-i.requestTime,i.bytesReceived=s.byteLength||s.length,i.bandwidth||(i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3))),t.headers&&(i.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(i.timedout=!0),!e&&!i.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(i&&(s||i.responseText)))),r(e,i)},vx=(i,e)=>{if(!i||!i.size)return;let t=e;return i.forEach(r=>{t=r(t)}),t},bx=(i,e,t,r)=>{!i||!i.size||i.forEach(s=>{s(e,t,r)})},km=function(){const i=function e(t,r){t=Te({timeout:45e3},t);const s=e.beforeRequest||F.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||F.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||F.Vhs.xhr._responseCallbackSet;s&&typeof s=="function"&&(F.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(s));const l=F.Vhs.xhr.original===!0?F.xhr:F.Vhs.xhr,u=vx(n,t);n.delete(s);const f=l(u||t,function(T,b){return bx(a,f,T,b),gl(f,T,b,r)}),p=f.abort;return f.abort=function(){return f.aborted=!0,p.apply(f,arguments)},f.uri=t.uri,f.requestType=t.requestType,f.requestTime=Date.now(),f};return i.original=!0,i},xx=function(i){let e;const t=i.offset;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=k.BigInt(i.offset)+k.BigInt(i.length)-k.BigInt(1):e=i.offset+i.length-1,"bytes="+t+"-"+e},yl=function(i){const e={};return i.byterange&&(e.Range=xx(i.byterange)),e},Sx=function(i,e){return i.start(e)+"-"+i.end(e)},Ex=function(i,e){const t=i.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},Cx=function(i){return i>=32&&i<126?String.fromCharCode(i):"."},Pm=function(i){const e={};return Object.keys(i).forEach(t=>{const r=i[t];rf(r)?e[t]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:e[t]=r}),e},ba=function(i){const e=i.byterange||{length:1/0,offset:0};return[e.length,e.offset,i.resolvedUri].join(",")},Lm=function(i){return i.resolvedUri},Rm=i=>{const e=Array.prototype.slice.call(i),t=16;let r="",s,n;for(let a=0;a<e.length/t;a++)s=e.slice(a*t,a*t+t).map(Ex).join(""),n=e.slice(a*t,a*t+t).map(Cx).join(""),r+=s+" "+n+`
194
- `;return r},Ax=({bytes:i})=>Rm(i),wx=i=>{let e="",t;for(t=0;t<i.length;t++)e+=Sx(i,t)+" ";return e};var Dx=Object.freeze({__proto__:null,createTransferableMessage:Pm,initSegmentId:ba,segmentKeyId:Lm,hexDump:Rm,tagDump:Ax,textRanges:wx});const Om=.25,Ix=(i,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,s=e.videoTimingInfo.transmuxedPresentationStart+t,n=i-s;return new Date(e.dateTimeObject.getTime()+n*1e3)},kx=i=>i.transmuxedPresentationEnd-i.transmuxedPresentationStart-i.transmuxerPrependedSeconds,Px=(i,e)=>{let t;try{t=new Date(i)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let r=e.segments[0];if(t<new Date(r.dateTimeObject))return null;for(let u=0;u<e.segments.length-1;u++){r=e.segments[u];const f=new Date(e.segments[u+1].dateTimeObject);if(t<f)break}const s=e.segments[e.segments.length-1],n=s.dateTimeObject,a=s.videoTimingInfo?kx(s.videoTimingInfo):s.duration+s.duration*Om,l=new Date(n.getTime()+a*1e3);return t>l?null:(t>new Date(n)&&(r=s),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:Tt.duration(e,e.mediaSequence+e.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})},Lx=(i,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,r;for(let n=0;n<e.segments.length&&(r=e.segments[n],t=r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationEnd:t+r.duration,!(i<=t));n++);const s=e.segments[e.segments.length-1];if(s.videoTimingInfo&&s.videoTimingInfo.transmuxedPresentationEnd<i)return null;if(i>t){if(i>t+s.duration*Om)return null;r=s}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:t-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},Rx=(i,e)=>{let t,r;try{t=new Date(i),r=new Date(e)}catch{}const s=t.getTime();return(r.getTime()-s)/1e3},Ox=i=>{if(!i.segments||i.segments.length===0)return!1;for(let e=0;e<i.segments.length;e++)if(!i.segments[e].dateTimeObject)return!1;return!0},Nx=({playlist:i,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!i||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const r=Lx(e,i);if(!r)return t({message:"valid programTime was not found"});if(r.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:r.estimatedStart});const s={mediaSeconds:e},n=Ix(e,r.segment);return n&&(s.programDateTime=n.toISOString()),t(null,s)},Nm=({programTime:i,playlist:e,retryCount:t=2,seekTo:r,pauseAfterSeek:s=!0,tech:n,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof i>"u"||!e||!r)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!n.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!Ox(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const l=Px(i,e);if(!l)return a({message:`${i} was not found in the stream`});const u=l.segment,f=Rx(u.dateTimeObject,i);if(l.type==="estimate"){if(t===0)return a({message:`${i} is not buffered yet. Try again`});r(l.estimatedStart+f),n.one("seeked",()=>{Nm({programTime:i,playlist:e,retryCount:t-1,seekTo:r,pauseAfterSeek:s,tech:n,callback:a})});return}const p=u.start+f,T=()=>a(null,n.currentTime());n.one("seeked",T),s&&n.pause(),r(p)},Ho=(i,e)=>{if(i.readyState===4)return e()},Bx=(i,e,t,r)=>{let s=[],n,a=!1;const l=function(T,b,S,A){return b.abort(),a=!0,t(T,b,S,A)},u=function(T,b){if(a)return;if(T)return T.metadata=or({requestType:r,request:b,error:T}),l(T,b,"",s);const S=b.responseText.substring(s&&s.byteLength||0,b.responseText.length);if(s=$v(s,sf(S,!0)),n=n||Ms(s),s.length<10||n&&s.length<n+2)return Ho(b,()=>l(T,b,"",s));const A=Gl(s);return A==="ts"&&s.length<188?Ho(b,()=>l(T,b,"",s)):!A&&s.length<376?Ho(b,()=>l(T,b,"",s)):l(null,b,A,s)},p=e({uri:i,beforeSend(T){T.overrideMimeType("text/plain; charset=x-user-defined"),T.addEventListener("progress",function({total:b,loaded:S}){return gl(T,null,{statusCode:T.status},u)})}},function(T,b){return gl(p,T,b,u)});return p},{EventTarget:Mx}=F,Xd=function(i,e){if(!Im(i,e)||i.sidx&&e.sidx&&(i.sidx.offset!==e.sidx.offset||i.sidx.length!==e.sidx.length))return!1;if(!i.sidx&&e.sidx||i.sidx&&!e.sidx||i.segments&&!e.segments||!i.segments&&e.segments)return!1;if(!i.segments&&!e.segments)return!0;for(let t=0;t<i.segments.length;t++){const r=i.segments[t],s=e.segments[t];if(r.uri!==s.uri)return!1;if(!r.byterange&&!s.byterange)continue;const n=r.byterange,a=s.byterange;if(n&&!a||!n&&a||n.offset!==a.offset||n.length!==a.length)return!1}return!0},Ux=(i,e,t,r)=>{const s=r.attributes.NAME||t;return`placeholder-uri-${i}-${e}-${s}`},Fx=({mainXml:i,srcUrl:e,clientOffset:t,sidxMapping:r,previousManifest:s})=>{const n=o2(i,{manifestUri:e,clientOffset:t,sidxMapping:r,previousManifest:s});return Cm(n,e,Ux),n},$x=(i,e)=>{ss(i,(t,r,s,n)=>{(!e.mediaGroups[r][s]||!(n in e.mediaGroups[r][s]))&&delete i.mediaGroups[r][s][n]})},jx=(i,e,t)=>{let r=!0,s=Te(i,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let n=0;n<e.playlists.length;n++){const a=e.playlists[n];if(a.sidx){const u=Na(a.sidx);t&&t[u]&&t[u].sidx&&Hl(a,t[u].sidx,a.sidx.resolvedUri)}const l=pl(s,a,Xd);l&&(s=l,r=!1)}return ss(e,(n,a,l,u)=>{if(n.playlists&&n.playlists.length){const f=n.playlists[0].id,p=pl(s,n.playlists[0],Xd);p&&(s=p,u in s.mediaGroups[a][l]||(s.mediaGroups[a][l][u]=n),s.mediaGroups[a][l][u].playlists[0]=s.playlists[f],r=!1)}}),$x(s,e),e.minimumUpdatePeriod!==i.minimumUpdatePeriod&&(r=!1),r?null:s},Vx=(i,e)=>(!i.map&&!e.map||!!(i.map&&e.map&&i.map.byterange.offset===e.map.byterange.offset&&i.map.byterange.length===e.map.byterange.length))&&i.uri===e.uri&&i.byterange.offset===e.byterange.offset&&i.byterange.length===e.byterange.length,Yd=(i,e)=>{const t={};for(const r in i){const n=i[r].sidx;if(n){const a=Na(n);if(!e[a])break;const l=e[a].sidxInfo;Vx(l,n)&&(t[a]=e[a])}}return t},qx=(i,e)=>{let r=Yd(i.playlists,e);return ss(i,(s,n,a,l)=>{if(s.playlists&&s.playlists.length){const u=s.playlists;r=Te(r,Yd(u,e))}}),r};class _l extends Mx{constructor(e,t,r={},s){super(),this.isPaused_=!0,this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);const{withCredentials:n=!1}=r;if(this.vhs_=t,this.withCredentials=n,this.addMetadataToTextTrack=r.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=$t("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,r){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},r&&(this.state=r),this.trigger("error"),!0}addSidxSegments_(e,t,r){const s=e.sidx&&Na(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s]){k.clearTimeout(this.mediaRequest_),this.mediaRequest_=k.setTimeout(()=>r(!1),0);return}const n=va(e.sidx.resolvedUri),a=(u,f)=>{if(this.requestErrored_(u,f,t))return;const p=this.mainPlaylistLoader_.sidxMapping_,{requestType:T}=f;let b;try{b=f2(se(f.response).subarray(8))}catch(S){S.metadata=or({requestType:T,request:f,parseFailure:!0}),this.requestErrored_(S,f,t);return}return p[s]={sidxInfo:e.sidx,sidx:b},Hl(e,b,e.sidx.resolvedUri),r(!0)},l="dash-sidx";this.request=Bx(n,this.vhs_.xhr,(u,f,p,T)=>{if(u)return a(u,f);if(!p||p!=="mp4"){const A=p||"unknown";return a({status:f.status,message:`Unsupported ${A} container type for sidx segment at URL: ${n}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},f)}const{offset:b,length:S}=e.sidx.byterange;if(T.length>=S+b)return a(u,{response:T.subarray(b,b+S),status:f.status,uri:f.uri});this.request=this.vhs_.xhr({uri:n,responseType:"arraybuffer",requestType:"dash-sidx",headers:yl({byterange:e.sidx.byterange})},a)},l)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},k.clearTimeout(this.minimumUpdatePeriodTimeout_),k.clearTimeout(this.mediaRequest_),k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const r=!this.media_||e.id!==this.media_.id;if(r&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}r&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,s=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,k.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(k.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const r=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=k.setTimeout(()=>this.load(),r);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){k.clearTimeout(this.mediaRequest_),this.mediaRequest_=k.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(r,s)=>{if(r){const{requestType:a}=s;r.metadata=or({requestType:a,request:s,error:r})}if(this.requestErrored_(r,s)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const n=s.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=s.responseText,s.responseHeaders&&s.responseHeaders.date?this.mainLoaded_=Date.parse(s.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=va(this.mainPlaylistLoader_.srcUrl,s),n){this.handleMain_(),this.syncClientServerClock_(()=>e(s,n));return}return e(s,n)})}syncClientServerClock_(e){const t=l2(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:_t(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(r,s)=>{if(!this.request)return;if(r){const{requestType:a}=s;return this.error.metadata=or({requestType:a,request:s,error:r}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let n;t.method==="HEAD"?!s.responseHeaders||!s.responseHeaders.date?n=this.mainLoaded_:n=Date.parse(s.responseHeaders.date):n=Date.parse(s.responseText),this.mainPlaylistLoader_.clientOffset_=n-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){k.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let r;try{r=Fx({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(n){this.error=n,this.error.metadata={errorType:F.Error.StreamingDashManifestParserError,error:n},this.trigger("error")}e&&(r=jx(e,r,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=r||e;const s=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(s&&s!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=s),(!e||r&&r.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(r),r){const{duration:n,endList:a}=r,l=[];r.playlists.forEach(f=>{l.push({id:f.id,bandwidth:f.attributes.BANDWIDTH,resolution:f.attributes.RESOLUTION,codecs:f.attributes.CODECS})});const u={duration:n,isLive:!a,renditions:l};t.parsedManifest=u,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!r}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(k.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=k.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=qx(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,r=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,r=!this.media_||this.media_!==t[e];if(r?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const s=()=>{this.media().endList||(this.mediaUpdateTimeout=k.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},ml(this.media(),!!r)))};s()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(r=>({cueTime:r.start,frames:[{data:r.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const r in e.contentProtection){const s=e.contentProtection[r].attributes["cenc:default_KID"];s&&t.add(s.replace(/-/g,"").toLowerCase())}return t}}}var Je={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const Hx=i=>{const e=new Uint8Array(new ArrayBuffer(i.length));for(let t=0;t<i.length;t++)e[t]=i.charCodeAt(t);return e.buffer},Bm=function(i){return i.on=i.addEventListener,i.off=i.removeEventListener,i},zx=function(i){try{return URL.createObjectURL(new Blob([i],{type:"application/javascript"}))}catch{const t=new BlobBuilder;return t.append(i),URL.createObjectURL(t.getBlob())}},Mm=function(i){return function(){const e=zx(i),t=Bm(new Worker(e));t.objURL=e;const r=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),r.call(this)},t}},Um=function(i){return`var browserWorkerPolyFill = ${Bm.toString()};
195
- 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
- `)},pi.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},pi.prototype.newLine=function(o){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(o),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},pi.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},pi.prototype.addText=function(o){this.rows[this.rowIdx]+=o},pi.prototype.backspace=function(){if(!this.isEmpty()){var o=this.rows[this.rowIdx];this.rows[this.rowIdx]=o.substr(0,o.length-1)}};var yn=function(o,c,d){this.serviceNum=o,this.text="",this.currentWindow=new pi(-1),this.windows=[],this.stream=d,typeof c=="string"&&this.createTextDecoder(c)};yn.prototype.init=function(o,c){this.startPts=o;for(var d=0;d<8;d++)this.windows[d]=new pi(d),typeof c=="function"&&(this.windows[d].beforeRowOverflow=c)},yn.prototype.setCurrentWindow=function(o){this.currentWindow=this.windows[o]},yn.prototype.createTextDecoder=function(o){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(o)}catch(c){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+o+" encoding. "+c})}};var we=function(o){o=o||{},we.prototype.init.call(this);var c=this,d=o.captionServices||{},h={},m;Object.keys(d).forEach(_=>{m=d[_],/^SERVICE/.test(_)&&(h[_]=m.encoding)}),this.serviceEncodings=h,this.current708Packet=null,this.services={},this.push=function(_){_.type===3?(c.new708Packet(),c.add708Bytes(_)):(c.current708Packet===null&&c.new708Packet(),c.add708Bytes(_))}};we.prototype=new io,we.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},we.prototype.add708Bytes=function(o){var c=o.ccData,d=c>>>8,h=c&255;this.current708Packet.ptsVals.push(o.pts),this.current708Packet.data.push(d),this.current708Packet.data.push(h)},we.prototype.push708Packet=function(){var o=this.current708Packet,c=o.data,d=null,h=null,m=0,_=c[m++];for(o.seq=_>>6,o.sizeCode=_&63;m<c.length;m++)_=c[m++],d=_>>5,h=_&31,d===7&&h>0&&(_=c[m++],d=_),this.pushServiceBlock(d,m,h),h>0&&(m+=h-1)},we.prototype.pushServiceBlock=function(o,c,d){var h,m=c,_=this.current708Packet.data,E=this.services[o];for(E||(E=this.initService(o,m));m<c+d&&m<_.length;m++)h=_[m],gn(h)?m=this.handleText(m,E):h===24?m=this.multiByteCharacter(m,E):h===16?m=this.extendedCommands(m,E):128<=h&&h<=135?m=this.setCurrentWindow(m,E):152<=h&&h<=159?m=this.defineWindow(m,E):h===136?m=this.clearWindows(m,E):h===140?m=this.deleteWindows(m,E):h===137?m=this.displayWindows(m,E):h===138?m=this.hideWindows(m,E):h===139?m=this.toggleWindows(m,E):h===151?m=this.setWindowAttributes(m,E):h===144?m=this.setPenAttributes(m,E):h===145?m=this.setPenColor(m,E):h===146?m=this.setPenLocation(m,E):h===143?E=this.reset(m,E):h===8?E.currentWindow.backspace():h===12?E.currentWindow.clearText():h===13?E.currentWindow.pendingNewLine=!0:h===14?E.currentWindow.clearText():h===141&&m++},we.prototype.extendedCommands=function(o,c){var d=this.current708Packet.data,h=d[++o];return gn(h)&&(o=this.handleText(o,c,{isExtended:!0})),o},we.prototype.getPts=function(o){return this.current708Packet.ptsVals[Math.floor(o/2)]},we.prototype.initService=function(o,c){var h="SERVICE"+o,d=this,h,m;return h in this.serviceEncodings&&(m=this.serviceEncodings[h]),this.services[o]=new yn(o,m,d),this.services[o].init(this.getPts(c),function(_){d.flushDisplayed(_,d.services[o])}),this.services[o]},we.prototype.handleText=function(o,c,d){var h=d&&d.isExtended,m=d&&d.isMultiByte,_=this.current708Packet.data,E=h?4096:0,C=_[o],D=_[o+1],I=c.currentWindow,N,V;function Q(z){return z.map(re=>("0"+(re&255).toString(16)).slice(-2)).join("")}if(m?(V=[C,D],o++):V=[C],c.textDecoder_&&!h)N=c.textDecoder_.decode(new Uint8Array(V));else if(m){const z=Q(V);N=String.fromCharCode(parseInt(z,16))}else N=Ag(E|C);return I.pendingNewLine&&!I.isEmpty()&&I.newLine(this.getPts(o)),I.pendingNewLine=!1,I.addText(N),o},we.prototype.multiByteCharacter=function(o,c){var d=this.current708Packet.data,h=d[o+1],m=d[o+2];return gn(h)&&gn(m)&&(o=this.handleText(++o,c,{isMultiByte:!0})),o},we.prototype.setCurrentWindow=function(o,c){var d=this.current708Packet.data,h=d[o],m=h&7;return c.setCurrentWindow(m),o},we.prototype.defineWindow=function(o,c){var d=this.current708Packet.data,h=d[o],m=h&7;c.setCurrentWindow(m);var _=c.currentWindow;return h=d[++o],_.visible=(h&32)>>5,_.rowLock=(h&16)>>4,_.columnLock=(h&8)>>3,_.priority=h&7,h=d[++o],_.relativePositioning=(h&128)>>7,_.anchorVertical=h&127,h=d[++o],_.anchorHorizontal=h,h=d[++o],_.anchorPoint=(h&240)>>4,_.rowCount=h&15,h=d[++o],_.columnCount=h&63,h=d[++o],_.windowStyle=(h&56)>>3,_.penStyle=h&7,_.virtualRowCount=_.rowCount+1,o},we.prototype.setWindowAttributes=function(o,c){var d=this.current708Packet.data,h=d[o],m=c.currentWindow.winAttr;return h=d[++o],m.fillOpacity=(h&192)>>6,m.fillRed=(h&48)>>4,m.fillGreen=(h&12)>>2,m.fillBlue=h&3,h=d[++o],m.borderType=(h&192)>>6,m.borderRed=(h&48)>>4,m.borderGreen=(h&12)>>2,m.borderBlue=h&3,h=d[++o],m.borderType+=(h&128)>>5,m.wordWrap=(h&64)>>6,m.printDirection=(h&48)>>4,m.scrollDirection=(h&12)>>2,m.justify=h&3,h=d[++o],m.effectSpeed=(h&240)>>4,m.effectDirection=(h&12)>>2,m.displayEffect=h&3,o},we.prototype.flushDisplayed=function(o,c){for(var d=[],h=0;h<8;h++)c.windows[h].visible&&!c.windows[h].isEmpty()&&d.push(c.windows[h].getText());c.endPts=o,c.text=d.join(`
198
-
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:
209
- currentTime: ${this.currentTime_()}
210
- bufferedEnd: ${qo(this.buffered_())}
211
- `,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!r||r.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-r.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const l=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!l.parts||!l.parts.length||!l.parts[this.partIndex])){const u=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=u}}s&&(s.mediaIndex-=a,s.mediaIndex<0?(s.mediaIndex=null,s.partIndex=null):(s.mediaIndex>=0&&(s.segment=e.segments[s.mediaIndex]),s.partIndex>=0&&s.segment.parts&&(s.part=s.segment.parts[s.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,e)}pause(){this.checkBufferTimeout_&&(k.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&zo.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,r=()=>{},s=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let n=1;const a=()=>{n--,n===0&&r()};(s||!this.audioDisabled_)&&(n++,this.sourceUpdater_.removeAudio(e,t,a)),(s||this.loaderType_==="main")&&(this.gopBuffer_=kS(this.gopBuffer_,e,t,this.timeMapping_),n++,this.sourceUpdater_.removeVideo(e,t,a));for(const l in this.inbandTextTracks_)Fs(e,t,this.inbandTextTracks_[l]);Fs(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&k.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=k.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&k.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=k.setTimeout(this.monitorBufferTick_.bind(this),RS)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:er({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,r=this.partIndex){if(!t||!this.mediaSource_)return!1;const s=typeof e=="number"&&t.segments[e],n=e+1===t.segments.length,a=!s||!s.parts||r+1===s.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&n&&a}chooseNextRequest_(){const e=this.buffered_(),t=qo(e)||0,r=Su(e,this.currentTime_()),s=!this.hasPlayed_()&&r>=1,n=r>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||s||n)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const l={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(l.isSyncRequest)l.mediaIndex=LS(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${l.mediaIndex}`);else if(this.mediaIndex!==null){const b=a[this.mediaIndex],S=typeof this.partIndex=="number"?this.partIndex:-1;l.startOfSegment=b.end?b.end:t,b.parts&&b.parts[S+1]?(l.mediaIndex=this.mediaIndex,l.partIndex=S+1):l.mediaIndex=this.mediaIndex+1}else{let b,S,A;const v=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
212
- For TargetTime: ${v}.
213
- CurrentTime: ${this.currentTime_()}
214
- BufferedEnd: ${t}
215
- 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
- ${Ym(e.uri)}
218
- ${Er(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=dS({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:l,level:u,stream:f})=>{this.logger_(`${Er(e)} logged from transmuxer stream ${f} as a ${u}: ${l}`)},triggerSegmentEventFn:({type:l,segment:u,keyInfo:f,trackInfo:p,timingInfo:T})=>{const S={segmentInfo:er({segment:u})};f&&(S.keyInfo=f),p&&(S.trackInfo=p),T&&(S.timingInfo=T),this.trigger({type:l,metadata:S})}})}trimBackBuffer_(e){const t=NS(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,r=e.part,s=e.segment.key||e.segment.map&&e.segment.map.key,n=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:r?r.resolvedUri:t.resolvedUri,byterange:r?r.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:s,isMediaInitialization:n},l=e.playlist.segments[e.mediaIndex-1];if(l&&l.timeline===t.timeline&&(l.videoTimingInfo?a.baseStartTime=l.videoTimingInfo.transmuxedDecodeEnd:l.audioTimingInfo&&(a.baseStartTime=l.audioTimingInfo.transmuxedDecodeEnd)),t.key){const u=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=u}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<Gn){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${Gn}`);return}const r={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:r}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,r){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,r));return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===oi.ABORTED)return;if(this.pause(),e.code===oi.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const s=this.pendingSegment_;this.saveBandwidthRelatedStats_(s.duration,t.stats),s.endOfAllRequests=t.endOfAllRequests,r.gopInfo&&(this.gopBuffer_=IS(this.gopBuffer_,r.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(s)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);t!==null&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){typeof e.start=="number"&&typeof e.end=="number"?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return e===null?!1:this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset()}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:r,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:n,useVideoTimingInfo:a,videoTimingInfo:l,audioTimingInfo:u}){if(typeof e<"u")return e;if(!a)return u.start;const f=t.segments[r-1];return r===0||!f||typeof f.start>"u"||f.end!==s+n?s:l.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:r,hasVideo:s,isMuxed:n}=t,a=this.loaderType_==="main"&&s,l=!this.audioDisabled_&&r&&!n;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,l&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),l&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=OS(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:r}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:r.start:r.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),s=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;s&&(e.timingInfo.end=typeof s.end=="number"?s.end:s.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const u={segmentInfo:er({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:u})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=$S(e,this.sourceType_);if(t&&(t.severity==="warn"?F.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${Er(e)}`);return}this.logger_(`Appended ${Er(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const r=e.segment,s=e.part,n=r.end&&this.currentTime_()-r.end>e.playlist.targetDuration*3,a=s&&s.end&&this.currentTime_()-s.end>e.playlist.partTargetDuration*3;if(n||a){this.logger_(`bad ${n?"segment":"part"} ${Er(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duration<Gn){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${Gn}`);return}const t=this.throughput.rate,r=Date.now()-e.endOfAllRequests+1,s=Math.floor(e.byteLength/r*8*1e3);this.throughput.rate+=(s-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,r=t.start,s=t.end;if(!rh(r)||!rh(s))return;Fs(r,s,this.segmentMetadataTrack_);const n=k.WebKitDataCue||k.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:r,end:s},l=JSON.stringify(a),u=new n(r,s,l);u.value=a,this.segmentMetadataTrack_.addCue(u)}}function _i(){}const Qm=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},jS=["video","audio"],xl=(i,e)=>{const t=e[`${i}Buffer`];return t&&t.updating||e.queuePending[i]},VS=(i,e)=>{for(let t=0;t<e.length;t++){const r=e[t];if(r.type==="mediaSource")return null;if(r.type===i)return t}return null},Mr=(i,e)=>{if(e.queue.length===0)return;let t=0,r=e.queue[t];if(r.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),r.action(e),r.doneFn&&r.doneFn(),Mr("audio",e),Mr("video",e));return}if(i!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||xl(i,e))){if(r.type!==i){if(t=VS(i,e.queue),t===null)return;r=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[i]=r,r.action(i,e),!r.doneFn){e.queuePending[i]=null,Mr(i,e);return}}},Jm=(i,e)=>{const t=e[`${i}Buffer`],r=Qm(i);t&&(t.removeEventListener("updateend",e[`on${r}UpdateEnd_`]),t.removeEventListener("error",e[`on${r}Error_`]),e.codecs[i]=null,e[`${i}Buffer`]=null)},ii=(i,e)=>i&&e&&Array.prototype.indexOf.call(i.sourceBuffers,e)!==-1,At={appendBuffer:(i,e,t)=>(r,s)=>{const n=s[`${r}Buffer`];if(ii(s.mediaSource,n)){s.logger_(`Appending segment ${e.mediaIndex}'s ${i.length} bytes to ${r}Buffer`);try{n.appendBuffer(i)}catch(a){s.logger_(`Error with code ${a.code} `+(a.code===Am?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${r}Buffer`),s.queuePending[r]=null,t(a)}}},remove:(i,e)=>(t,r)=>{const s=r[`${t}Buffer`];if(ii(r.mediaSource,s)){r.logger_(`Removing ${i} to ${e} from ${t}Buffer`);try{s.remove(i,e)}catch{r.logger_(`Remove ${i} to ${e} from ${t}Buffer failed`)}}},timestampOffset:i=>(e,t)=>{const r=t[`${e}Buffer`];ii(t.mediaSource,r)&&(t.logger_(`Setting ${e}timestampOffset to ${i}`),r.timestampOffset=i)},callback:i=>(e,t)=>{i()},endOfStream:i=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${i||""})`);try{e.mediaSource.endOfStream(i)}catch(t){F.log.warn("Failed to call media source endOfStream",t)}}},duration:i=>e=>{e.logger_(`Setting mediaSource duration to ${i}`);try{e.mediaSource.duration=i}catch(t){F.log.warn("Failed to set media source duration",t)}},abort:()=>(i,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${i}Buffer`];if(ii(e.mediaSource,t)){e.logger_(`calling abort on ${i}Buffer`);try{t.abort()}catch(r){F.log.warn(`Failed to abort on ${i}Buffer`,r)}}},addSourceBuffer:(i,e)=>t=>{const r=Qm(i),s=Ur(e);t.logger_(`Adding ${i}Buffer with codec ${e} to mediaSource`);const n=t.mediaSource.addSourceBuffer(s);n.addEventListener("updateend",t[`on${r}UpdateEnd_`]),n.addEventListener("error",t[`on${r}Error_`]),t.codecs[i]=e,t[`${i}Buffer`]=n},removeSourceBuffer:i=>e=>{const t=e[`${i}Buffer`];if(Jm(i,e),!!ii(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(r){F.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,r)}}},changeType:i=>(e,t)=>{const r=t[`${e}Buffer`],s=Ur(i);if(!ii(t.mediaSource,r))return;const n=i.substring(0,i.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===n)return;const u={codecsChangeInfo:{from:a,to:i}};t.trigger({type:"codecschange",metadata:u}),t.logger_(`changing ${e}Buffer codec from ${a} to ${i}`);try{r.changeType(s),t.codecs[e]=i}catch(f){u.errorType=F.Error.StreamingCodecsChangeError,u.error=f,f.metadata=u,t.error_=f,t.trigger("error"),F.log.warn(`Failed to changeType on ${e}Buffer`,f)}}},wt=({type:i,sourceUpdater:e,action:t,doneFn:r,name:s})=>{e.queue.push({type:i,action:t,doneFn:r,name:s}),Mr(i,e)},ah=(i,e)=>t=>{const r=e[`${i}Buffered`](),s=ex(r);if(e.logger_(`received "updateend" event for ${i} Source Buffer: `,s),e.queuePending[i]){const n=e.queuePending[i].doneFn;e.queuePending[i]=null,n&&n(e[`${i}Error_`])}Mr(i,e)};class Zm extends F.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Mr("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=$t("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=ah("video",this),this.onAudioUpdateEnd_=ah("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){wt({type:"mediaSource",sourceUpdater:this,action:At.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){wt({type:e,sourceUpdater:this,action:At.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){F.log.error("removeSourceBuffer is not supported!");return}wt({type:"mediaSource",sourceUpdater:this,action:At.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!F.browser.IS_FIREFOX&&k.MediaSource&&k.MediaSource.prototype&&typeof k.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return k.SourceBuffer&&k.SourceBuffer.prototype&&typeof k.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){F.log.error("changeType is not supported!");return}wt({type:e,sourceUpdater:this,action:At.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const r=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,r);this.canChangeType()&&this.changeType(t,r)})}appendBuffer(e,t){const{segmentInfo:r,type:s,bytes:n}=e;if(this.processedAppend_=!0,s==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${n.length} until video append`);return}const a=t;if(wt({type:s,sourceUpdater:this,action:At.appendBuffer(n,r||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),s==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const l=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${l.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,l.forEach(u=>{this.appendBuffer.apply(this,u)})}}audioBuffered(){return ii(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:et()}videoBuffered(){return ii(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:et()}buffered(){const e=ii(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=ii(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():ix(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=_i){wt({type:"mediaSource",sourceUpdater:this,action:At.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=_i){typeof e!="string"&&(e=void 0),wt({type:"mediaSource",sourceUpdater:this,action:At.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,r=_i){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){r();return}wt({type:"audio",sourceUpdater:this,action:At.remove(e,t),doneFn:r,name:"remove"})}removeVideo(e,t,r=_i){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){r();return}wt({type:"video",sourceUpdater:this,action:At.remove(e,t),doneFn:r,name:"remove"})}updating(){return!!(xl("audio",this)||xl("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(wt({type:"audio",sourceUpdater:this,action:At.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(wt({type:"video",sourceUpdater:this,action:At.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&wt({type:"audio",sourceUpdater:this,action:At.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&wt({type:"video",sourceUpdater:this,action:At.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),jS.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>Jm(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const oh=i=>decodeURIComponent(escape(String.fromCharCode.apply(null,i))),qS=i=>{const e=new Uint8Array(i);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},lh=new Uint8Array(`
219
-
220
- `.split("").map(i=>i.charCodeAt(0)));class HS extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class zS extends bl{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return et();const e=this.subtitlesTrack_.cues,t=e[0].startTime,r=e[e.length-1].startTime;return et([[t,r]])}initSegmentForMap(e,t=!1){if(!e)return null;const r=ba(e);let s=this.initSegments_[r];if(t&&!s&&e.bytes){const n=lh.byteLength+e.bytes.byteLength,a=new Uint8Array(n);a.set(e.bytes),a.set(lh,e.bytes.byteLength),this.initSegments_[r]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){Fs(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,r){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===oi.TIMEOUT&&this.handleTimeout_(),e.code===oi.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const s=this.pendingSegment_,n=r.mp4VttCues&&r.mp4VttCues.length;n&&(s.mp4VttCues=r.mp4VttCues),this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const a=s.segment;if(a.map&&(a.map.bytes=t.map.bytes),s.bytes=t.bytes,typeof k.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,r),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(s)}catch(l){this.stopForError({message:l.message,metadata:{errorType:F.Error.StreamingVttParserError,error:l}});return}if(n||this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,s.cues.forEach(l=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new k.VTTCue(l.startTime,l.endTime,l.text):l)}),wS(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const r=e&&e.type==="vtt",s=t&&t.type==="text";r&&s&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(r=>{const s=r.start+t,n=r.end+t,a=new k.VTTCue(s,n,r.cueText);r.settings&&r.settings.split(" ").forEach(l=>{const u=l.split(":"),f=u[0],p=u[1];a[f]=isNaN(p)?p:Number(p)}),e.cues.push(a)})}parseVTTCues_(e){let t,r=!1;if(typeof k.WebVTT!="function")throw new HS;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof k.TextDecoder=="function"?t=new k.TextDecoder("utf8"):(t=k.WebVTT.StringDecoder(),r=!0);const s=new k.WebVTT.Parser(k,k.vttjs,t);if(s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=a=>{e.timestampmap=a},s.onparsingerror=a=>{F.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;r&&(a=oh(a)),s.parse(a)}let n=e.bytes;r&&(n=oh(n)),s.parse(n),s.flush()}updateTimeMapping_(e,t,r){const s=e.segment;if(!t)return;if(!e.cues.length){s.empty=!0;return}const{MPEGTS:n,LOCAL:a}=e.timestampmap,u=n/tr.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(f=>{const p=f.endTime-f.startTime,T=this.handleRollover_(f.startTime+u,t.time);f.startTime=Math.max(T,0),f.endTime=Math.max(T+p,0)}),!r.syncInfo){const f=e.cues[0].startTime,p=e.cues[e.cues.length-1].startTime;r.syncInfo={mediaSequence:r.mediaSequence+e.mediaIndex,time:Math.min(f,p-s.duration)}}}handleRollover_(e,t){if(t===null)return e;let r=e*tr.ONE_SECOND_IN_TS;const s=t*tr.ONE_SECOND_IN_TS;let n;for(s<r?n=-8589934592:n=8589934592;Math.abs(r-s)>4294967296;)r+=n;return r/tr.ONE_SECOND_IN_TS}}const WS=function(i,e){const t=i.cues;for(let r=0;r<t.length;r++){const s=t[r];if(e>=s.adStartTime&&e<=s.adEndTime)return s}return null},GS=function(i,e,t=0){if(!i.segments)return;let r=t,s;for(let n=0;n<i.segments.length;n++){const a=i.segments[n];if(s||(s=WS(e,r+a.duration/2)),s){if("cueIn"in a){s.endTime=r,s.adEndTime=r,r+=a.duration,s=null;continue}if(r<s.endTime){r+=a.duration;continue}s.endTime+=a.duration}else if("cueOut"in a&&(s=new k.VTTCue(r,r+a.duration,a.cueOut),s.adStartTime=r,s.adEndTime=r+parseFloat(a.cueOut),e.addCue(s)),"cueOutCont"in a){const[l,u]=a.cueOutCont.split("/").map(parseFloat);s=new k.VTTCue(r,r+a.duration,""),s.adStartTime=r-l,s.adEndTime=s.adStartTime+u,e.addCue(s)}r+=a.duration}};class uh{constructor({start:e,end:t,segmentIndex:r,partIndex:s=null,appended:n=!1}){this.start_=e,this.end_=t,this.segmentIndex_=r,this.partIndex_=s,this.appended_=n}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class KS{constructor(e,t=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=t}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class eg{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:r,segments:s}=e;if(this.isReliable_=this.isReliablePlaylist_(r,s),!!this.isReliable_)return this.updateStorage_(s,r,this.calculateBaseTime_(r,s,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:r}of this.storage_.values())if(r.length){for(const s of r)if(s.isInRange(e))return s}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,r){const s=new Map;let n=`
221
- `,a=r,l=t;this.start_=a,e.forEach((u,f)=>{const p=this.storage_.get(l),T=a,b=T+u.duration,S=!!(p&&p.segmentSyncInfo&&p.segmentSyncInfo.isAppended),A=new uh({start:T,end:b,appended:S,segmentIndex:f});u.syncInfo=A;let v=a;const L=(u.parts||[]).map((P,M)=>{const O=v,U=v+P.duration,R=!!(p&&p.partsSyncInfo&&p.partsSyncInfo[M]&&p.partsSyncInfo[M].isAppended),q=new uh({start:O,end:U,appended:R,segmentIndex:f,partIndex:M});return v=U,n+=`Media Sequence: ${l}.${M} | Range: ${O} --> ${U} | Appended: ${R}
222
- `,P.syncInfo=q,q});s.set(l,new KS(A,L)),n+=`${Ym(u.resolvedUri)} | Media Sequence: ${l} | Range: ${T} --> ${b} | Appended: ${S}
223
- `,l++,a=b}),this.end_=a,this.storage_=s,this.diagnostics_=n}calculateBaseTime_(e,t,r){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const s=Math.min(...this.storage_.keys());if(e<s){const n=s-e;let a=this.storage_.get(s).segmentSyncInfo.start;for(let l=0;l<n;l++){const u=t[l];a-=u.duration}return a}return r}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class ch extends eg{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,r){if(!this.storage_.size){const s=this.parent_.getSyncInfoForMediaSequence(e);return s?s.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,r)}}const XS=86400,Wo=[{name:"VOD",run:(i,e,t,r,s)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(i,e,t,r,s,n)=>{const a=i.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;const l=a.getSyncInfoForTime(s);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(i,e,t,r,s)=>{if(!Object.keys(i.timelineToDatetimeMappings).length)return null;let n=null,a=null;const l=hl(e);s=s||0;for(let u=0;u<l.length;u++){const f=e.endList||s===0?u:l.length-(u+1),p=l[f],T=p.segment,b=i.timelineToDatetimeMappings[T.timeline];if(!b||!T.dateTimeObject)continue;let A=T.dateTimeObject.getTime()/1e3+b;if(T.parts&&typeof p.partIndex=="number")for(let L=0;L<p.partIndex;L++)A+=T.parts[L].duration;const v=Math.abs(s-A);if(a!==null&&(v===0||a<v))break;a=v,n={time:A,segmentIndex:p.segmentIndex,partIndex:p.partIndex}}return n}},{name:"Segment",run:(i,e,t,r,s)=>{let n=null,a=null;s=s||0;const l=hl(e);for(let u=0;u<l.length;u++){const f=e.endList||s===0?u:l.length-(u+1),p=l[f],T=p.segment,b=p.part&&p.part.start||T&&T.start;if(T.timeline===r&&typeof b<"u"){const S=Math.abs(s-b);if(a!==null&&a<S)break;(!n||a===null||a>=S)&&(a=S,n={time:b,segmentIndex:p.segmentIndex,partIndex:p.partIndex})}}return n}},{name:"Discontinuity",run:(i,e,t,r,s)=>{let n=null;if(s=s||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let l=0;l<e.discontinuityStarts.length;l++){const u=e.discontinuityStarts[l],f=e.discontinuitySequence+l+1,p=i.discontinuities[f];if(p){const T=Math.abs(s-p.time);if(a!==null&&a<T)break;(!n||a===null||a>=T)&&(a=T,n={time:p.time,segmentIndex:u,partIndex:null})}}}return n}},{name:"Playlist",run:(i,e,t,r,s)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class YS extends F.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new eg,r=new ch(t),s=new ch(t);this.mediaSequenceStorage_={main:t,audio:r,vtt:s},this.logger_=$t("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,r,s,n){if(t!==1/0)return Wo.find(({name:u})=>u==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,r,s,n);if(!a.length)return null;for(const l of a){const{syncPoint:u,strategy:f}=l,{segmentIndex:p,time:T}=u;if(p<0)continue;const b=e.segments[p],S=T,A=S+b.duration;if(this.logger_(`Strategy: ${f}. Current time: ${s}. selected segment: ${p}. Time: [${S} -> ${A}]}`),s>=S&&s<A)return this.logger_("Found sync point with exact match: ",u),u}return this.selectSyncPoint_(a,{key:"time",value:s})}getExpiredTime(e,t){if(!e||!e.segments)return null;const r=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!r.length)return null;const s=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return s.segmentIndex>0&&(s.time*=-1),Math.abs(s.time+zs({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,t,r,s,n){const a=[];for(let l=0;l<Wo.length;l++){const u=Wo[l],f=u.run(this,e,t,r,s,n);f&&(f.strategy=u.name,a.push({strategy:u.name,syncPoint:f}))}return a}selectSyncPoint_(e,t){let r=e[0].syncPoint,s=Math.abs(e[0].syncPoint[t.key]-t.value),n=e[0].strategy;for(let a=1;a<e.length;a++){const l=Math.abs(e[a].syncPoint[t.key]-t.value);l<s&&(s=l,r=e[a].syncPoint,n=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${n}]: [time:${r.time}, segmentIndex:${r.segmentIndex}`+(typeof r.partIndex=="number"?`,partIndex:${r.partIndex}`:"")+"]"),r}saveExpiredSegmentInfo(e,t){const r=t.mediaSequence-e.mediaSequence;if(r>XS){F.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let s=r-1;s>=0;s--){const n=e.segments[s];if(n&&typeof n.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+s,time:n.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],r=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}));const n=s.dateTimeObject;s.discontinuity&&t&&n&&(this.timelineToDatetimeMappings[s.timeline]=-(n.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,r){const s=e.segment,n=e.part;let a=this.timelines[e.timeline],l,u;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},r&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),l=e.startOfSegment,u=t.end+a.mapping;else if(a)l=t.start+a.mapping,u=t.end+a.mapping;else return!1;return n&&(n.start=l,n.end=u),(!s.start||l<s.start)&&(s.start=l),s.end=u,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,r=e.segment;if(r.discontinuity)this.discontinuities[r.timeline]={time:r.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let s=0;s<t.discontinuityStarts.length;s++){const n=t.discontinuityStarts[s],a=t.discontinuitySequence+s+1,l=n-e.mediaIndex,u=Math.abs(l);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>u){let f;l<0?f=r.start-zs({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:n}):f=r.end+zs({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:n}),this.discontinuities[a]={time:f,accuracy:u}}}}dispose(){this.trigger("dispose"),this.off()}}class QS extends F.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:r}){return typeof t=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:r}){if(typeof t=="number"&&typeof r=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:r},delete this.pendingTimelineChanges_[e];const s={timelineChangeInfo:{from:t,to:r}};this.trigger({type:"timelinechange",metadata:s})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const JS=Um(Fm(function(){var i=function(){function v(){this.listeners={}}var L=v.prototype;return L.on=function(M,O){this.listeners[M]||(this.listeners[M]=[]),this.listeners[M].push(O)},L.off=function(M,O){if(!this.listeners[M])return!1;var U=this.listeners[M].indexOf(O);return this.listeners[M]=this.listeners[M].slice(0),this.listeners[M].splice(U,1),U>-1},L.trigger=function(M){var O=this.listeners[M];if(O)if(arguments.length===2)for(var U=O.length,R=0;R<U;++R)O[R].call(this,arguments[1]);else for(var q=Array.prototype.slice.call(arguments,1),Y=O.length,K=0;K<Y;++K)O[K].apply(this,q)},L.dispose=function(){this.listeners={}},L.pipe=function(M){this.on("data",function(O){M.push(O)})},v}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(v){return v.subarray(0,v.byteLength-v[v.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const t=function(){const v=[[[],[],[],[],[]],[[],[],[],[],[]]],L=v[0],P=v[1],M=L[4],O=P[4];let U,R,q;const Y=[],K=[];let ie,me,le,ge,ee,ce;for(U=0;U<256;U++)K[(Y[U]=U<<1^(U>>7)*283)^U]=U;for(R=q=0;!M[R];R^=ie||1,q=K[q]||1)for(ge=q^q<<1^q<<2^q<<3^q<<4,ge=ge>>8^ge&255^99,M[R]=ge,O[ge]=R,le=Y[me=Y[ie=Y[R]]],ce=le*16843009^me*65537^ie*257^R*16843008,ee=Y[ge]*257^ge*16843008,U=0;U<4;U++)L[U][R]=ee=ee<<24^ee>>>8,P[U][ge]=ce=ce<<24^ce>>>8;for(U=0;U<5;U++)L[U]=L[U].slice(0),P[U]=P[U].slice(0);return v};let r=null;class s{constructor(L){r||(r=t()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let P,M,O;const U=this._tables[0][4],R=this._tables[1],q=L.length;let Y=1;if(q!==4&&q!==6&&q!==8)throw new Error("Invalid aes key size");const K=L.slice(0),ie=[];for(this._key=[K,ie],P=q;P<4*q+28;P++)O=K[P-1],(P%q===0||q===8&&P%q===4)&&(O=U[O>>>24]<<24^U[O>>16&255]<<16^U[O>>8&255]<<8^U[O&255],P%q===0&&(O=O<<8^O>>>24^Y<<24,Y=Y<<1^(Y>>7)*283)),K[P]=K[P-q]^O;for(M=0;P;M++,P--)O=K[M&3?P:P-4],P<=4||M<4?ie[M]=O:ie[M]=R[0][U[O>>>24]]^R[1][U[O>>16&255]]^R[2][U[O>>8&255]]^R[3][U[O&255]]}decrypt(L,P,M,O,U,R){const q=this._key[1];let Y=L^q[0],K=O^q[1],ie=M^q[2],me=P^q[3],le,ge,ee;const ce=q.length/4-2;let te,de=4;const ve=this._tables[1],Ve=ve[0],Ye=ve[1],Ce=ve[2],_e=ve[3],St=ve[4];for(te=0;te<ce;te++)le=Ve[Y>>>24]^Ye[K>>16&255]^Ce[ie>>8&255]^_e[me&255]^q[de],ge=Ve[K>>>24]^Ye[ie>>16&255]^Ce[me>>8&255]^_e[Y&255]^q[de+1],ee=Ve[ie>>>24]^Ye[me>>16&255]^Ce[Y>>8&255]^_e[K&255]^q[de+2],me=Ve[me>>>24]^Ye[Y>>16&255]^Ce[K>>8&255]^_e[ie&255]^q[de+3],de+=4,Y=le,K=ge,ie=ee;for(te=0;te<4;te++)U[(3&-te)+R]=St[Y>>>24]<<24^St[K>>16&255]<<16^St[ie>>8&255]<<8^St[me&255]^q[de++],le=Y,Y=K,K=ie,ie=me,me=le}}class n extends i{constructor(){super(i),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(L){this.jobs.push(L),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(v){return v<<24|(v&65280)<<8|(v&16711680)>>8|v>>>24},l=function(v,L,P){const M=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),O=new s(Array.prototype.slice.call(L)),U=new Uint8Array(v.byteLength),R=new Int32Array(U.buffer);let q,Y,K,ie,me,le,ge,ee,ce;for(q=P[0],Y=P[1],K=P[2],ie=P[3],ce=0;ce<M.length;ce+=4)me=a(M[ce]),le=a(M[ce+1]),ge=a(M[ce+2]),ee=a(M[ce+3]),O.decrypt(me,le,ge,ee,R,ce),R[ce]=a(R[ce]^q),R[ce+1]=a(R[ce+1]^Y),R[ce+2]=a(R[ce+2]^K),R[ce+3]=a(R[ce+3]^ie),q=me,Y=le,K=ge,ie=ee;return U};class u{constructor(L,P,M,O){const U=u.STEP,R=new Int32Array(L.buffer),q=new Uint8Array(L.byteLength);let Y=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(R.subarray(Y,Y+U),P,M,q)),Y=U;Y<R.length;Y+=U)M=new Uint32Array([a(R[Y-4]),a(R[Y-3]),a(R[Y-2]),a(R[Y-1])]),this.asyncStream_.push(this.decryptChunk_(R.subarray(Y,Y+U),P,M,q));this.asyncStream_.push(function(){O(null,e(q))})}static get STEP(){return 32e3}decryptChunk_(L,P,M,O){return function(){const U=l(L,P,M);O.set(U,L.byteOffset)}}}var f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof oe.global<"u"?oe.global:typeof self<"u"?self:{},p;typeof window<"u"?p=window:typeof f<"u"?p=f:typeof self<"u"?p=self:p={};var T=p,b=function(L){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(L):L&&L.buffer instanceof ArrayBuffer},S=T.BigInt||Number;S("0x1"),S("0x100"),S("0x10000"),S("0x1000000"),S("0x100000000"),S("0x10000000000"),S("0x1000000000000"),S("0x100000000000000"),S("0x10000000000000000"),function(){var v=new Uint16Array([65484]),L=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);return L[0]===255?"big":L[0]===204?"little":"unknown"}();const A=function(v){const L={};return Object.keys(v).forEach(P=>{const M=v[P];b(M)?L[P]={bytes:M.buffer,byteOffset:M.byteOffset,byteLength:M.byteLength}:L[P]=M}),L};self.onmessage=function(v){const L=v.data,P=new Uint8Array(L.encrypted.bytes,L.encrypted.byteOffset,L.encrypted.byteLength),M=new Uint32Array(L.key.bytes,L.key.byteOffset,L.key.byteLength/4),O=new Uint32Array(L.iv.bytes,L.iv.byteOffset,L.iv.byteLength/4);new u(P,M,O,function(U,R){self.postMessage(A({source:L.source,decrypted:R}),[R.buffer])})}}));var ZS=Mm(JS);const eE=i=>{let e=i.default?"main":"alternative";return i.characteristics&&i.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},tg=(i,e)=>{i.abort(),i.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Sl=(i,e)=>{e.activePlaylistLoader=i,i.load()},tE=(i,e)=>()=>{const{segmentLoaders:{[i]:t,main:r},mediaTypes:{[i]:s}}=e,n=s.activeTrack(),a=s.getActiveGroup(),l=s.activePlaylistLoader,u=s.lastGroup_;if(!(a&&u&&a.id===u.id)&&(s.lastGroup_=a,s.lastTrack_=n,tg(t,s),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){l&&r.resetEverything();return}t.resyncLoader(),Sl(a.playlistLoader,s)}},iE=(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:r}}=e;r.lastGroup_=null,t.abort(),t.pause()},rE=(i,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[i]:r,main:s},mediaTypes:{[i]:n}}=e,a=n.activeTrack(),l=n.getActiveGroup(),u=n.activePlaylistLoader,f=n.lastTrack_;if(!(f&&a&&f.id===a.id)&&(n.lastGroup_=l,n.lastTrack_=a,tg(r,n),!!l)){if(l.isMainPlaylist){if(!a||!f||a.id===f.id)return;const p=e.vhs.playlistController_,T=p.selectPlaylist();if(p.media()===T)return;n.logger_(`track change. Switching main audio from ${f.id} to ${a.id}`),t.pause(),s.resetEverything(),p.fastQualityChange_(T);return}if(i==="AUDIO"){if(!l.playlistLoader){s.setAudio(!0),s.resetEverything();return}r.setAudio(!0),s.setAudio(!1)}if(u===l.playlistLoader){Sl(l.playlistLoader,n);return}r.track&&r.track(a),r.resetEverything(),Sl(l.playlistLoader,n)}},Ea={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:t},excludePlaylist:r}=e,s=t.activeTrack(),n=t.activeGroup(),a=(n.filter(u=>u.default)[0]||n[0]).id,l=t.tracks[a];if(s===l){r({error:{message:"Problem encountered loading the default audio track."}});return}F.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const u in t.tracks)t.tracks[u].enabled=t.tracks[u]===l;t.onTrackChanged()},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:t}}=e;F.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=t.activeTrack();r&&(r.mode="disabled"),t.onTrackChanged()}},dh={AUDIO:(i,e,t)=>{if(!e)return;const{tech:r,requestOptions:s,segmentLoaders:{[i]:n}}=t;e.on("loadedmetadata",()=>{const a=e.media();n.playlist(a,s),(!r.paused()||a.endList&&r.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),s),r.paused()||n.load()}),e.on("error",Ea[i](i,t))},SUBTITLES:(i,e,t)=>{const{tech:r,requestOptions:s,segmentLoaders:{[i]:n},mediaTypes:{[i]:a}}=t;e.on("loadedmetadata",()=>{const l=e.media();n.playlist(l,s),n.track(a.activeTrack()),(!r.paused()||l.endList&&r.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),s),r.paused()||n.load()}),e.on("error",Ea[i](i,t))}},sE={AUDIO:(i,e)=>{const{vhs:t,sourceType:r,segmentLoaders:{[i]:s},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[i]:{groups:l,tracks:u,logger_:f}},mainPlaylistLoader:p}=e,T=hn(p.main);(!a[i]||Object.keys(a[i]).length===0)&&(a[i]={main:{default:{default:!0}}},T&&(a[i].main.default.playlists=p.main.playlists));for(const b in a[i]){l[b]||(l[b]=[]);for(const S in a[i][b]){let A=a[i][b][S],v;if(T?(f(`AUDIO group '${b}' label '${S}' is a main playlist`),A.isMainPlaylist=!0,v=null):r==="vhs-json"&&A.playlists?v=new Ir(A.playlists[0],t,n):A.resolvedUri?v=new Ir(A.resolvedUri,t,n):A.playlists&&r==="dash"?v=new _l(A.playlists[0],t,n,p):v=null,A=Te({id:S,playlistLoader:v},A),dh[i](i,A.playlistLoader,e),l[b].push(A),typeof u[S]>"u"){const L=new F.AudioTrack({id:S,kind:eE(A),enabled:!1,language:A.language,default:A.default,label:S});u[S]=L}}}s.on("error",Ea[i](i,e))},SUBTITLES:(i,e)=>{const{tech:t,vhs:r,sourceType:s,segmentLoaders:{[i]:n},requestOptions:a,main:{mediaGroups:l},mediaTypes:{[i]:{groups:u,tracks:f}},mainPlaylistLoader:p}=e;for(const T in l[i]){u[T]||(u[T]=[]);for(const b in l[i][T]){if(!r.options_.useForcedSubtitles&&l[i][T][b].forced)continue;let S=l[i][T][b],A;if(s==="hls")A=new Ir(S.resolvedUri,r,a);else if(s==="dash"){if(!S.playlists.filter(L=>L.excludeUntil!==1/0).length)return;A=new _l(S.playlists[0],r,a,p)}else s==="vhs-json"&&(A=new Ir(S.playlists?S.playlists[0]:S.resolvedUri,r,a));if(S=Te({id:b,playlistLoader:A},S),dh[i](i,S.playlistLoader,e),u[T].push(S),typeof f[b]>"u"){const v=t.addRemoteTextTrack({id:b,kind:"subtitles",default:S.default&&S.autoselect,language:S.language,label:b},!1).track;f[b]=v}}}n.on("error",Ea[i](i,e))},"CLOSED-CAPTIONS":(i,e)=>{const{tech:t,main:{mediaGroups:r},mediaTypes:{[i]:{groups:s,tracks:n}}}=e;for(const a in r[i]){s[a]||(s[a]=[]);for(const l in r[i][a]){const u=r[i][a][l];if(!/^(?:CC|SERVICE)/.test(u.instreamId))continue;const f=t.options_.vhs&&t.options_.vhs.captionServices||{};let p={label:l,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(f[p.instreamId]&&(p=Te(p,f[p.instreamId])),p.default===void 0&&delete p.default,s[a].push(Te({id:l},u)),typeof n[l]>"u"){const T=t.addRemoteTextTrack({id:p.instreamId,kind:"captions",default:p.default,language:p.language,label:p.label},!1).track;n[l]=T}}}}},ig=(i,e)=>{for(let t=0;t<i.length;t++)if(Au(e,i[t])||i[t].playlists&&ig(i[t].playlists,e))return!0;return!1},nE=(i,e)=>t=>{const{mainPlaylistLoader:r,mediaTypes:{[i]:{groups:s}}}=e,n=r.media();if(!n)return null;let a=null;n.attributes[i]&&(a=s[n.attributes[i]]);const l=Object.keys(s);if(!a)if(i==="AUDIO"&&l.length>1&&hn(e.main))for(let u=0;u<l.length;u++){const f=s[l[u]];if(ig(f,n)){a=f;break}}else s.main?a=s.main:l.length===1&&(a=s[l[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(u=>u.id===t.id)[0]||null},aE={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].enabled)return t[r];return null},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].mode==="showing"||t[r].mode==="hidden")return t[r];return null}},oE=(i,{mediaTypes:e})=>()=>{const t=e[i].activeTrack();return t?e[i].activeGroup(t):null},lE=i=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(f=>{sE[f](f,i)});const{mediaTypes:e,mainPlaylistLoader:t,tech:r,vhs:s,segmentLoaders:{["AUDIO"]:n,main:a}}=i;["AUDIO","SUBTITLES"].forEach(f=>{e[f].activeGroup=nE(f,i),e[f].activeTrack=aE[f](f,i),e[f].onGroupChanged=tE(f,i),e[f].onGroupChanging=iE(f,i),e[f].onTrackChanged=rE(f,i),e[f].getActiveGroup=oE(f,i)});const l=e.AUDIO.activeGroup();if(l){const f=(l.filter(T=>T.default)[0]||l[0]).id;e.AUDIO.tracks[f].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(f=>e[f].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(f=>e[f].onGroupChanging())});const u=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",u),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),s.on("dispose",()=>{r.audioTracks().removeEventListener("change",u),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const f in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[f])},uE=()=>{const i={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:_i,activeTrack:_i,getActiveGroup:_i,onGroupChanged:_i,onTrackChanged:_i,lastTrack_:null,logger_:$t(`MediaGroups[${e}]`)}}),i};class hh{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=_t(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class cE extends F.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new hh,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=$t("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const r=t.serverUri||t.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=_t(e,r),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const r=e?t:this.getRequestURI(t);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const s={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(n,a)=>{if(n){if(a.status===410){this.logger_(`manifest request 410 ${n}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(a.status===429){const f=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${n}.`),this.logger_(`content steering will retry in ${f} seconds.`),this.startTTLTimeout_(parseInt(f,10));return}this.logger_(`manifest failed to load ${n}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:s});let l;try{l=JSON.parse(this.request_.responseText)}catch(f){const p={errorType:F.Error.StreamingContentSteeringParserError,error:f};this.trigger({type:"error",metadata:p})}this.assignSteeringProperties_(l);const u={contentSteeringInfo:s.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:u}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new k.URL(e),r=new k.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const t=JSON.parse(k.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new k.URL(e),r=this.getPathway(),s=this.getBandwidth_();if(r){const n=`_${this.manifestType_}_pathway`;t.searchParams.set(n,r)}if(s){const n=`_${this.manifestType_}_throughput`;t.searchParams.set(n,s)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const r=(s=>{for(const n of s)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==r&&(this.currentPathway=r,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=s=>this.excludedSteeringManifestURLs.has(s);if(this.proxyServerUrl_){const s=this.setProxyServerUrl_(e);if(!t(s))return s}const r=this.setSteeringParams_(e);return t(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=k.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){k.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new hh}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(_t(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const dE=(i,e)=>{let t=null;return(...r)=>{clearTimeout(t),t=setTimeout(()=>{i.apply(null,r)},e)}},hE=10;let Ui;const fE=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],pE=function(i){return this.audioSegmentLoader_[i]+this.mainSegmentLoader_[i]},mE=function({currentPlaylist:i,buffered:e,currentTime:t,nextPlaylist:r,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:a,bufferBasedABR:l,log:u}){if(!r)return F.log.warn("We received no playlist to switch to. Please check your stream."),!1;const f=`allowing switch ${i&&i.id||"null"} -> ${r.id}`;if(!i)return u(`${f} as current playlist is not set`),!0;if(r.id===i.id)return!1;const p=!!Dr(e,t).length;if(!i.endList)return!p&&typeof i.partTargetDuration=="number"?(u(`not ${f} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(u(`${f} as current playlist is live`),!0);const T=Su(e,t),b=l?Je.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Je.MAX_BUFFER_LOW_WATER_LINE;if(a<b)return u(`${f} as duration < max low water line (${a} < ${b})`),!0;const S=r.attributes.BANDWIDTH,A=i.attributes.BANDWIDTH;if(S<A&&(!l||T<n)){let v=`${f} as next bandwidth < current bandwidth (${S} < ${A})`;return l&&(v+=` and forwardBuffer < bufferHighWaterLine (${T} < ${n})`),u(v),!0}if((!l||S>A)&&T>=s){let v=`${f} as forwardBuffer >= bufferLowWaterLine (${T} >= ${s})`;return l&&(v+=` and next bandwidth > current bandwidth (${S} > ${A})`),u(v),!0}return u(`not ${f} as no switching criteria met`),!1};class gE extends F.EventTarget{constructor(e){super(),this.fastQualityChange_=dE(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:r,tech:s,bandwidth:n,externVhs:a,useCueTags:l,playlistExclusionDuration:u,enableLowInitialPlaylist:f,sourceType:p,cacheEncryptionKeys:T,bufferBasedABR:b,leastPixelDiffSelector:S,captionServices:A,experimentalUseMMS:v}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:L}=e;(L===null||typeof L>"u")&&(L=1/0),Ui=a,this.bufferBasedABR=!!b,this.leastPixelDiffSelector=!!S,this.withCredentials=r,this.tech_=s,this.vhs_=s.vhs,this.player_=e.player_,this.sourceType_=p,this.useCueTags_=l,this.playlistExclusionDuration=u,this.maxPlaylistRetries=L,this.enableLowInitialPlaylist=f,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:L,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=uE(),v&&k.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new k.ManagedMediaSource,this.usingManagedMediaSource_=!0,F.log("Using ManagedMediaSource")):k.MediaSource&&(this.mediaSource=new k.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=et(),this.hasPlayed_=!1,this.syncController_=new YS(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new ZS,this.sourceUpdater_=new Zm(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new QS,this.keyStatusMap_=new Map;const P={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:A,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:n,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:T,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new _l(t,this.vhs_,Te(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Ir(t,this.vhs_,Te(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new bl(Te(P,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new bl(Te(P,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new zS(Te(P,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((U,R)=>{function q(){s.off("vttjserror",Y),U()}function Y(){s.off("vttjsloaded",q),R()}s.one("vttjsloaded",q),s.one("vttjserror",Y),s.addWebVttScript_()})}),e);const M=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new cE(this.vhs_.xhr,M),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),fE.forEach(U=>{this[U+"_"]=pE.bind(this,U)}),this.logger_=$t("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const O=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(O,()=>{const U=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-U,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,r){const s=this.media(),n=s&&(s.id||s.uri),a=e&&(e.id||e.uri);if(n&&n!==a){this.logger_(`switch media ${n} -> ${a} from ${t}`);const l={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:l}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],r=t?t.activeGroup():null,s=this.contentSteeringController_.getPathway();if(r&&s){const a=(r.length?r[0].playlists:r.playlists).filter(l=>l.attributes.serviceLocation===s);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=k.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(k.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const r=e.mediaGroups.AUDIO,s=Object.keys(r);let n;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{const l=r.main||s.length&&r[s[0]];for(const u in l)if(l[u].default){n={label:u};break}}if(!n)return t;const a=[];for(const l in r)if(r[l][n.label]){const u=r[l][n.label];if(u.playlists&&u.playlists.length)a.push.apply(a,u.playlists);else if(u.uri)a.push(u);else if(e.playlists.length)for(let f=0;f<e.playlists.length;f++){const p=e.playlists[f];p.attributes&&p.attributes.AUDIO&&p.attributes.AUDIO===l&&a.push(p)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),r=t.targetDuration*1.5*1e3;fl(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),lE({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let r;if(this.enableLowInitialPlaylist&&(r=this.selectInitialPlaylist()),r||(r=this.selectPlaylist()),!r||!this.shouldSwitchToMedia_(r)||(this.initialMedia_=r,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),r=t.targetDuration*1.5*1e3;fl(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,r=>{this.player_.trigger(Ke({},r))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const r=e.mediaGroups||{};let s=!0;const n=Object.keys(r.AUDIO);for(const a in r.AUDIO)for(const l in r.AUDIO[a])r.AUDIO[a][l].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Ui.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),n.length&&Object.keys(r.AUDIO[n[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),s=this.bufferLowWaterLine(),n=this.bufferHighWaterLine(),a=this.tech_.buffered();return mE({buffered:a,currentTime:r,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const r=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:r.playlist,error:r})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const r=this.audioSegmentLoader_.pendingSegment_;if(!r||!r.segment||!r.segment.syncInfo)return;const s=r.segment.syncInfo.end+.01;this.tech_.setCurrentTime(s)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",r=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:hE}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const r=this.getCodecsOrExclude_();r&&this.sourceUpdater_.addOrChangeSourceBuffers(r)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(r=>{this.mainSegmentLoader_.on(r,s=>{this.player_.trigger(Ke({},s))}),this.audioSegmentLoader_.on(r,s=>{this.player_.trigger(Ke({},s))}),this.subtitleSegmentLoader_.on(r,s=>{this.player_.trigger(Ke({},s))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const r=t.end(0);let s=r;if(e.start){const n=e.start.timeOffset;n<0?s=Math.max(r+n,t.start(0)):s=Math.min(r,n)}this.trigger("firstplay"),this.tech_.setCurrentTime(s)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const r=this.syncController_.getExpiredTime(e,this.duration());if(r===null)return!1;const s=Ui.Playlist.playlistEnd(e,r),n=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return s-n<=ai;const l=a.end(a.length-1);return l-n<=ai&&s-l<=ai}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const s=this.mainPlaylistLoader_.main.playlists,n=s.filter(eo),a=n.length===1&&n[0]===e;if(s.length===1&&r!==1/0)return F.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const A=this.pathwayAttribute_(e),v=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(A),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(A)},v);return}let S=!1;s.forEach(A=>{if(A===e)return;const v=A.excludeUntil;typeof v<"u"&&v!==1/0&&(S=!0,delete A.excludeUntil)}),S&&(F.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+r*1e3,e.excludeUntil=l,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const u=this.selectPlaylist();if(!u){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const f=t.internal?this.logger_:F.log.warn,p=t.message?" "+t.message:"";f(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${p} Switching to playlist ${u.id}.`),u.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),u.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const T=u.targetDuration/2*1e3||5*1e3,b=typeof u.lastRequest=="number"&&Date.now()-u.lastRequest<=T;return this.switchMedia_(u,"exclude",a||b)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const r=[],s=e==="all";(s||e==="main")&&r.push(this.mainPlaylistLoader_);const n=[];(s||e==="audio")&&n.push("AUDIO"),(s||e==="subtitle")&&(n.push("CLOSED-CAPTIONS"),n.push("SUBTITLES")),n.forEach(a=>{const l=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;l&&r.push(l)}),["main","audio","subtitle"].forEach(a=>{const l=this[`${a}SegmentLoader_`];l&&(e===a||e==="all")&&r.push(l)}),r.forEach(a=>t.forEach(l=>{typeof a[l]=="function"&&a[l]()}))}setCurrentTime(e){const t=Dr(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Ui.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const r=e.media();if(!r)return null;const s=this.syncController_.getMediaSequenceSync(t);if(s&&s.isReliable){const l=s.start,u=s.end;if(!isFinite(l)||!isFinite(u))return null;const f=Ui.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r),p=Math.max(0,u-f);return p<l?null:et([[l,p]])}const n=this.syncController_.getExpiredTime(r,this.duration());if(n===null)return null;const a=Ui.Playlist.seekable(r,n,Ui.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const r=e.start(0),s=e.end(0),n=t.start(0),a=t.end(0);return n>s||r>a?e:et([[Math.max(r,n),Math.min(s,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const r=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||r&&r.length&&this.seekable_.length&&r.start(0)===this.seekable_.start(0)&&r.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${fm(this.seekable_)}]`);const s={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:s}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const s=this.seekable();if(!s.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<s.end(s.length-1))&&this.sourceUpdater_.setDuration(s.end(s.length-1));return}const t=this.tech_.buffered();let r=Ui.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(r=Math.max(r,t.end(t.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const r in t)t[r].forEach(s=>{s.playlistLoader&&s.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=Ws(this.main(),t),s={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=r.video||e.main.videoCodec||Lv),e.main.isMuxed&&(s.video+=`,${r.audio||e.main.audioCodec||Gc}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(s.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||Gc,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!s.audio&&!s.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(f,p)=>f?js(p,this.usingManagedMediaSource_):Io(p),l={};let u;if(["video","audio"].forEach(function(f){if(s.hasOwnProperty(f)&&!a(e[f].isFmp4,s[f])){const p=e[f].isFmp4?"browser":"muxer";l[p]=l[p]||[],l[p].push(s[f]),f==="audio"&&(u=p)}}),n&&u&&t.attributes.AUDIO){const f=t.attributes.AUDIO;this.main().playlists.forEach(p=>{(p.attributes&&p.attributes.AUDIO)===f&&p!==t&&(p.excludeUntil=1/0)}),this.logger_(`excluding audio group ${f} as ${u} does not support codec(s): "${s.audio}"`)}if(Object.keys(l).length){const f=Object.keys(l).reduce((p,T)=>(p&&(p+=", "),p+=`${T} does not support codec(s): "${l[T].join(",")}"`,p),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:f},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const f=[];if(["video","audio"].forEach(p=>{const T=(ti(this.sourceUpdater_.codecs[p]||"")[0]||{}).type,b=(ti(s[p]||"")[0]||{}).type;T&&b&&T.toLowerCase()!==b.toLowerCase()&&f.push(`"${this.sourceUpdater_.codecs[p]}" -> "${s[p]}"`)}),f.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${f.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return s}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(r=>{const s=e[r];if(t.indexOf(s.id)!==-1)return;t.push(s.id);const n=Ws(this.main,s),a=[];n.audio&&!Io(n.audio)&&!js(n.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${n.audio}`),n.video&&!Io(n.video)&&!js(n.video,this.usingManagedMediaSource_)&&a.push(`video codec ${n.video}`),n.text&&n.text==="stpp.ttml.im1t"&&a.push(`text codec ${n.text}`),a.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],r=this.main().playlists,s=xa(ti(e)),n=Zd(s),a=s.video&&ti(s.video)[0]||null,l=s.audio&&ti(s.audio)[0]||null;Object.keys(r).forEach(u=>{const f=r[u];if(t.indexOf(f.id)!==-1||f.excludeUntil===1/0)return;t.push(f.id);const p=[],T=Ws(this.mainPlaylistLoader_.main,f),b=Zd(T);if(!(!T.audio&&!T.video)){if(b!==n&&p.push(`codec count "${b}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const S=T.video&&ti(T.video)[0]||null,A=T.audio&&ti(T.audio)[0]||null;S&&a&&S.type.toLowerCase()!==a.type.toLowerCase()&&p.push(`video codec "${S.type}" !== "${a.type}"`),A&&l&&A.type.toLowerCase()!==l.type.toLowerCase()&&p.push(`audio codec "${A.type}" !== "${l.type}"`)}p.length&&(f.excludeUntil=1/0,this.logger_(`excluding ${f.id}: ${p.join(" && ")}`))}})}updateAdCues_(e){let t=0;const r=this.seekable();r.length&&(t=r.start(0)),GS(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Je.GOAL_BUFFER_LENGTH,r=Je.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,Je.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*r,s)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Je.BUFFER_LOW_WATER_LINE,r=Je.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,Je.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,Je.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*r,this.bufferBasedABR?n:s)}bufferHighWaterLine(){return Je.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){ih(this.inbandTextTracks_,"com.apple.streaming",this.tech_),AS({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,r){const s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();ih(this.inbandTextTracks_,e,this.tech_),SS({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:r})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,r=>{this.trigger(Ke({},r))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const n=this.contentSteeringController_.getAvailablePathways(),a=[];for(const l of t.playlists){const u=l.attributes.serviceLocation;if(u&&(a.push(u),!n.has(u)))return!0}return!!(!a.length&&n.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const r=this.main().playlists,s=new Set;let n=!1;Object.keys(r).forEach(a=>{const l=r[a],u=this.pathwayAttribute_(l),f=u&&e!==u;l.excludeUntil===1/0&&l.lastExcludeReason_==="content-steering"&&!f&&(delete l.excludeUntil,delete l.lastExcludeReason_,n=!0);const T=!l.excludeUntil&&l.excludeUntil!==1/0;!s.has(l.id)&&f&&T&&(s.add(l.id),l.excludeUntil=1/0,l.lastExcludeReason_="content-steering",this.logger_(`excluding ${l.id} for ${l.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const l=this.mediaTypes_[a];if(l.activePlaylistLoader){const u=l.activePlaylistLoader.media_;u&&u.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,r=this.contentSteeringController_.currentPathwayClones,s=this.contentSteeringController_.nextPathwayClones;if(r&&r.size||s&&s.size){for(const[a,l]of r.entries())s.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(l),this.contentSteeringController_.excludePathway(a));for(const[a,l]of s.entries()){const u=r.get(a);if(!u){t.filter(p=>p.attributes["PATHWAY-ID"]===l["BASE-ID"]).forEach(p=>{this.mainPlaylistLoader_.addClonePathway(l,p)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(u,l)||(this.mainPlaylistLoader_.updateOrDeleteClone(l,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...s])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,s=t["URI-REPLACEMENT"].PARAMS;for(const n in r)if(r[n]!==s[n])return!1;for(const n in s)if(r[n]!==s[n])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const s=this.mainPlaylistLoader_.getKeyIdSet(r);!s||!s.size||s.forEach(n=>{const a="usable",l=this.keyStatusMap_.has(n)&&this.keyStatusMap_.get(n)===a,u=r.lastExcludeReason_===t&&r.excludeUntil===1/0;l?l&&u&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${n} is ${a}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==t&&(r.excludeUntil=1/0,r.lastExcludeReason_=t,this.logger_(`excluding playlist ${r.id} because the key ID ${n} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const s=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,n=r.excludeUntil===1/0&&r.lastExcludeReason_===t;s&&n&&(delete r.excludeUntil,F.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const n=(typeof e=="string"?e:qS(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${n} added to the keyStatusMap`),this.keyStatusMap_.set(n,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const yE=(i,e,t)=>r=>{const s=i.main.playlists[e],n=Cu(s),a=eo(s);if(typeof r>"u")return a;r?delete s.disabled:s.disabled=!0;const l={renditionInfo:{id:e,bandwidth:s.attributes.BANDWIDTH,resolution:s.attributes.RESOLUTION,codecs:s.attributes.CODECS},cause:"fast-quality"};return r!==a&&!n&&(r?(t(s),i.trigger({type:"renditionenabled",metadata:l})):i.trigger({type:"renditiondisabled",metadata:l})),r};class _E{constructor(e,t,r){const{playlistController_:s}=e,n=s.fastQualityChange_.bind(s);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=Ws(s.main(),t),this.playlist=t,this.id=r,this.enabled=yE(e.playlists,t.id,n)}}const TE=function(i){i.representations=()=>{const e=i.playlistController_.main(),t=hn(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(r=>!Cu(r)).map((r,s)=>new _E(i,r,r.id)):[]}},fh=["seeking","seeked","pause","playing","error"];class vE extends F.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=$t("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),n=()=>this.resetTimeUpdate_(),a=this.playlistController_,l=["main","subtitle","audio"],u={};l.forEach(p=>{u[p]={reset:()=>this.resetSegmentDownloads_(p),updateend:()=>this.checkSegmentDownloads_(p)},a[`${p}SegmentLoader_`].on("appendsdone",u[p].updateend),a[`${p}SegmentLoader_`].on("playlistupdate",u[p].reset),this.tech_.on(["seeked","seeking"],u[p].reset)});const f=p=>{["main","audio"].forEach(T=>{a[`${T}SegmentLoader_`][p]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),f("off"))},this.clearSeekingAppendCheck_=()=>f("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),f("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(fh,n),this.tech_.on("canplay",r),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(fh,n),this.tech_.off("canplay",r),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(p=>{a[`${p}SegmentLoader_`].off("appendsdone",u[p].updateend),a[`${p}SegmentLoader_`].off("playlistupdate",u[p].reset),this.tech_.off(["seeked","seeking"],u[p].reset)}),this.checkCurrentTimeTimeout_&&k.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&k.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=k.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,r=t[`${e}SegmentLoader_`],s=r.buffered_(),n=sx(this[`${e}Buffered_`],s);if(this[`${e}Buffered_`]=s,n){const a={bufferedRanges:s};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:ir(s)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+ai>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(et([this.lastRecordedTime,e]));const r={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:r}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),r=this.tech_.currentTime(),s=this.afterSeekableWindow_(t,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(s&&(n=t.end(t.length-1)),this.beforeSeekableWindow_(t,r)){const A=t.start(0);n=A+(A===t.end(0)?0:ai)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${r} with seekable range ${fm(t)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const a=this.playlistController_.sourceUpdater_,l=this.tech_.buffered(),u=a.audioBuffer?a.audioBuffered():null,f=a.videoBuffer?a.videoBuffered():null,p=this.media(),T=p.partTargetDuration?p.partTargetDuration:(p.targetDuration-ni)*2,b=[u,f];for(let A=0;A<b.length;A++){if(!b[A])continue;if(Su(b[A],r)<T)return!1}const S=zn(l,r);return S.length===0?!1:(n=S.start(0)+ai,this.logger_(`Buffered region starts (${S.start(0)}) just beyond seek point (${r}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),r=Dr(t,e);if(r.length&&e+3<=r.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${r.start(0)} -> ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const l=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${l}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(l),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,s=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=zn(s,t);return a.length>0?(this.logger_(`Stopped at ${t} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,r,s=!1){if(!e.length)return!1;let n=e.end(e.length-1)+ai;const a=!r.endList,l=typeof r.partTargetDuration=="number";return a&&(l||s)&&(n=e.end(e.length-1)+r.targetDuration*3),t>n}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:r}){if(!e)return;let s;if(e.length&&t.length){const n=Dr(e,r-3),a=Dr(e,r),l=Dr(t,r);l.length&&!a.length&&n.length&&(s={start:n.end(0),end:l.end(0)})}else zn(e,r).length||(s=this.gapFromVideoUnderflow_(e,r));return s?(this.logger_(`Encountered a gap in video from ${s.start} to ${s.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),r=this.tech_.currentTime(),s=zn(t,r);if(this.resetTimeUpdate_(),s.length===0||r!==e)return;this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",e,"nextRange start:",s.start(0)),this.tech_.setCurrentTime(s.start(0)+ni);const n={gapInfo:{from:r,to:s.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:n}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const r=tx(e);for(let s=0;s<r.length;s++){const n=r.start(s),a=r.end(s);if(t-n<4&&t-n>2)return{start:n,end:a}}return null}}const bE={errorInterval:30,getSource(i){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return i(t)}},rg=function(i,e){let t=0,r=0;const s=Te(bE,e);i.ready(()=>{i.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const n=function(){r&&i.currentTime(r)},a=function(p){p!=null&&(r=i.duration()!==1/0&&i.currentTime()||0,i.one("loadedmetadata",n),i.src(p),i.trigger({type:"usage",name:"vhs-error-reload"}),i.play())},l=function(){if(Date.now()-t<s.errorInterval*1e3){i.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!s.getSource||typeof s.getSource!="function"){F.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),s.getSource.call(i,a)},u=function(){i.off("loadedmetadata",n),i.off("error",l),i.off("dispose",u)},f=function(p){u(),rg(i,p)};i.on("error",l),i.on("dispose",u),i.reloadSourceOnError=f},xE=function(i){rg(this,i)};var sg="3.16.2",SE="7.1.0",EE="1.3.1",CE="7.2.0",AE="4.0.2";const $e={PlaylistLoader:Ir,Playlist:Tt,utils:Dx,STANDARD_PLAYLIST_SELECTOR:th,INITIAL_PLAYLIST_SELECTOR:_S,lastBandwidthSelector:th,movingAverageBandwidthSelector:gS,comparePlaylistBandwidth:Du,comparePlaylistResolution:mS,xhr:km()};Object.keys(Je).forEach(i=>{Object.defineProperty($e,i,{get(){return F.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),Je[i]},set(e){if(F.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){F.log.warn(`value of Vhs.${i} must be greater than or equal to 0`);return}Je[i]=e}})});const ng="videojs-vhs",ag=function(i,e){const t=e.media();let r=-1;for(let s=0;s<i.length;s++)if(i[s].id===t.id){r=s;break}i.selectedIndex_=r,i.trigger({selectedIndex:r,type:"change"})},wE=function(i,e){e.representations().forEach(t=>{i.addQualityLevel(t)}),ag(i,e.playlists)};$e.canPlaySource=function(){return F.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const DE=(i,e,t)=>{if(!i)return i;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=xa(ti(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(r.audio=t.attributes.CODECS);const s=Ur(r.video),n=Ur(r.audio),a={};for(const l in i)a[l]={},n&&(a[l].audioContentType=n),s&&(a[l].videoContentType=s),e.contentProtection&&e.contentProtection[l]&&e.contentProtection[l].pssh&&(a[l].pssh=e.contentProtection[l].pssh),typeof i[l]=="string"&&(a[l].url=i[l]);return Te(i,a)},IE=(i,e)=>i.reduce((t,r)=>{if(!r.contentProtection)return t;const s=e.reduce((n,a)=>{const l=r.contentProtection[a];return l&&l.pssh&&(n[a]={pssh:l.pssh}),n},{});return Object.keys(s).length&&t.push(s),t},[]),kE=({player:i,sourceKeySystems:e,audioMedia:t,mainPlaylists:r})=>{if(!i.eme.initializeMediaKeys)return Promise.resolve();const s=t?r.concat([t]):r,n=IE(s,Object.keys(e)),a=[],l=[];return n.forEach(u=>{l.push(new Promise((f,p)=>{i.tech_.one("keysessioncreated",f)})),a.push(new Promise((f,p)=>{i.eme.initializeMediaKeys({keySystems:u},T=>{if(T){p(T);return}f()})}))}),Promise.race([Promise.all(a),Promise.race(l)])},PE=({player:i,sourceKeySystems:e,media:t,audioMedia:r})=>{const s=DE(e,t,r);return s?(i.currentSource().keySystems=s,s&&!i.eme?(F.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},og=()=>{if(!k.localStorage)return null;const i=k.localStorage.getItem(ng);if(!i)return null;try{return JSON.parse(i)}catch{return null}},LE=i=>{if(!k.localStorage)return!1;let e=og();e=e?Te(e,i):i;try{k.localStorage.setItem(ng,JSON.stringify(e))}catch{return!1}return e},RE=i=>i.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(i.substring(i.indexOf(",")+1)):i,lg=(i,e)=>{i._requestCallbackSet||(i._requestCallbackSet=new Set),i._requestCallbackSet.add(e)},ug=(i,e)=>{i._responseCallbackSet||(i._responseCallbackSet=new Set),i._responseCallbackSet.add(e)},cg=(i,e)=>{i._requestCallbackSet&&(i._requestCallbackSet.delete(e),i._requestCallbackSet.size||delete i._requestCallbackSet)},dg=(i,e)=>{i._responseCallbackSet&&(i._responseCallbackSet.delete(e),i._responseCallbackSet.size||delete i._responseCallbackSet)};$e.supportsNativeHls=function(){if(!X||!X.createElement)return!1;const i=X.createElement("video");return F.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(i.canPlayType(t))}):!1}();$e.supportsNativeDash=function(){return!X||!X.createElement||!F.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(X.createElement("video").canPlayType("application/dash+xml"))}();$e.supportsTypeNatively=i=>i==="hls"?$e.supportsNativeHls:i==="dash"?$e.supportsNativeDash:!1;$e.isSupported=function(){return F.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};$e.xhr.onRequest=function(i){lg($e.xhr,i)};$e.xhr.onResponse=function(i){ug($e.xhr,i)};$e.xhr.offRequest=function(i){cg($e.xhr,i)};$e.xhr.offResponse=function(i){dg($e.xhr,i)};const OE=F.getComponent("Component");class hg extends OE{constructor(e,t,r){if(super(t,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=$t("VhsHandler"),t.options_&&t.options_.playerId){const s=F.getPlayer(t.options_.playerId);this.player_=s}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(X,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],s=>{const n=X.fullscreenElement||X.webkitFullscreenElement||X.mozFullScreenElement||X.msFullscreenElement;n&&n.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=Te(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const r=og();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Je.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Je.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=RE(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=$e,this.options_.sourceType=tf(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.options_.player_=this.player_,this.playlistController_=new gE(this.options_);const r=Te({liveRangeSafeTimeDelta:ai},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new vE(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const n=F.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),n.error(a)});const s=this.options_.bufferBasedABR?$e.movingAverageBandwidthSelector(.55):$e.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):s.bind(this),this.playlistController_.selectInitialPlaylist=$e.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(n){this.playlistController_.selectPlaylist=n.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(n){this.playlistController_.mainSegmentLoader_.throughput.rate=n,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let n=this.playlistController_.mainSegmentLoader_.bandwidth;const a=k.navigator.connection||k.navigator.mozConnection||k.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&a){const u=a.downlink*1e3*1e3;u>=l&&n>=l?n=Math.max(n,u):n=u}return n},set(n){this.playlistController_.mainSegmentLoader_.bandwidth=n,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const n=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(n+a))},set(){F.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>ir(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>ir(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&LE({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{TE(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=k.URL.createObjectURL(this.playlistController_.mediaSource),(F.browser.IS_ANY_SAFARI||F.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),kE({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=PE({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=F.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{wE(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{ag(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":sg,"mux.js":SE,"mpd-parser":EE,"m3u8-parser":CE,"aes-decrypter":AE}}version(){return this.constructor.version()}canChangeType(){return Zm.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&k.URL.revokeObjectURL&&(k.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return Nx({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,r=!0,s=2){return Nm({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{lg(this.xhr,e)},this.xhr.onResponse=e=>{ug(this.xhr,e)},this.xhr.offRequest=e=>{cg(this.xhr,e)},this.xhr.offResponse=e=>{dg(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(r=>{this.playlistController_.on(r,s=>{this.player_.trigger(Ke({},s))})}),t.forEach(r=>{this.playbackWatcher_.on(r,s=>{this.player_.trigger(Ke({},s))})})}}const Ca={name:"videojs-http-streaming",VERSION:sg,canHandleSource(i,e={}){const t=Te(F.options,e);return!t.vhs.experimentalUseMMS&&!js("avc1.4d400d,mp4a.40.2",!1)?!1:Ca.canPlayType(i.type,t)},handleSource(i,e,t={}){const r=Te(F.options,t);return e.vhs=new hg(i,e,r),e.vhs.xhr=km(),e.vhs.setupXhrHooks_(),e.vhs.src(i.src,i.type),e.vhs},canPlayType(i,e){const t=tf(i);if(!t)return"";const r=Ca.getOverrideNative(e);return!$e.supportsTypeNatively(t)||r?"maybe":""},getOverrideNative(i={}){const{vhs:e={}}=i,t=!(F.browser.IS_ANY_SAFARI||F.browser.IS_IOS),{overrideNative:r=t}=e;return r}},NE=()=>js("avc1.4d400d,mp4a.40.2",!0);NE()&&F.getTech("Html5").registerSourceHandler(Ca,0);F.VhsHandler=hg;F.VhsSourceHandler=Ca;F.Vhs=$e;F.use||F.registerComponent("Vhs",$e);F.options.vhs=F.options.vhs||{};(!F.getPlugin||!F.getPlugin("reloadSourceOnError"))&&F.registerPlugin("reloadSourceOnError",xE);class BE{constructor(e){this.id=e.getAttribute("id"),this.allowMultipleAds=e.getAttribute("allowMultipleAds"),this.followRedirects=e.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null;for(const t in e.childNodes){const r=e.childNodes[t];switch(r.localName){case"AdTagURI":this.adTagURI={templateType:r.getAttribute("templateType"),uri:(r.textContent||r.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=r.firstChild;this.vastAdData&&this.vastAdData.nodeType!==1;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=r;break}}}}function fg(i,e){const t=[];for(const r in i.childNodes){const s=i.childNodes[r];(s.nodeName===e||e===`vmap:${s.nodeName}`||s.nodeName===`vmap:${e}`)&&t.push(s)}return t}function ME(i){if(!i||!i.childNodes)return{};const e=i.childNodes,t=[];for(const s in e){const n=e[s];n.nodeName==="#cdata-section"&&t.push(n)}if(t&&t.length>0)try{return JSON.parse(t[0].data)}catch{}let r="";for(const s in e){const n=e[s];switch(n.nodeName){case"#text":r+=n.textContent.trim();break;case"#cdata-section":r+=n.data;break}}return r}function Iu(i){const e={attributes:{},children:{},value:{}};e.value=ME(i);const t=i.attributes;if(t)for(const s in t){const n=t[s];n.nodeName&&n.nodeValue!==void 0&&n.nodeValue!==null&&(e.attributes[n.nodeName]=n.nodeValue)}const r=i.childNodes;if(r)for(const s in r){const n=r[s];n.nodeName&&n.nodeName.substring(0,1)!=="#"&&(e.children[n.nodeName]=Iu(n))}return e}class UE{constructor(e){this.timeOffset=e.getAttribute("timeOffset"),this.breakType=e.getAttribute("breakType"),this.breakId=e.getAttribute("breakId"),this.repeatAfter=e.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[];for(const t in e.childNodes){const r=e.childNodes[t];switch(r.localName){case"AdSource":this.adSource=new BE(r);break;case"TrackingEvents":for(const s in r.childNodes){const n=r.childNodes[s];n.localName==="Tracking"&&this.trackingEvents.push({event:n.getAttribute("event"),uri:(n.textContent||n.text||"").trim()})}break;case"Extensions":this.extensions=fg(r,"Extension").map(s=>Iu(s));break}}}track(e,t){for(const r in this.trackingEvents){const s=this.trackingEvents[r];if(s.event===e){let{uri:n}=s;s.event==="error"&&(n=n.replace("[ERRORCODE]",t)),this.tracker(n)}}}tracker(e){if(typeof window<"u"&&window!==null){const t=new Image;t.src=e}}}class FE{constructor(e){if(!e||!e.documentElement||e.documentElement.localName!=="VMAP")throw new Error("Not a VMAP document");this.version=e.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[];for(const t in e.documentElement.childNodes){const r=e.documentElement.childNodes[t];switch(r.localName){case"AdBreak":this.adBreaks.push(new UE(r));break;case"Extensions":this.extensions=fg(r,"Extension").map(s=>Iu(s));break}}}}const $E=(i,e)=>{const t=goog.pal,r=new t.ConsentSettings;r.allowStorage=!1;const s=new t.NonceLoader(r);return async()=>{try{const n=new URL(e),a=new t.NonceRequest;let l=localStorage.getItem("sl-device-id")||Cs.v4(),u=sessionStorage.getItem("sl-ad-session-id");u||(u=Cs.v4(),sessionStorage.setItem("sl-ad-session-id",u)),Cs.validate(l)||(l=Cs.v5(`https://${l}`,Cs.v5.URL)),n.searchParams.get("url")||n.searchParams.set("url","https://streamlayer.io"),n.searchParams.get("description_url")||n.searchParams.set("description_url","https://streamlayer.io"),a.adWillAutoPlay=n.searchParams.get("vpa")==="auto",a.adWillPlayMuted=n.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=n.searchParams.get("description_url"),a.iconsSupported=!0,a.sessionId=l,a.supportedApiFrameworks="2,7,9",a.videoHeight=i.clientHeight,a.videoWidth=i.clientWidth;const f=await s.loadNonceManager(a);return n.searchParams.get("is_lat")==="[placeholder]"&&n.searchParams.set("is_lat","1"),n.searchParams.get("rdid")==="[placeholder]"&&n.searchParams.set("rdid",l),n.searchParams.get("correlator")==="[placeholder]"&&n.searchParams.set("correlator",u),n.searchParams.set("wta","1"),n.searchParams.set("givn",f.getNonce()),{url:n,manager:f}}catch(n){console.log("AdsManager could not be started",n);return}}},jE=new hT,VE=i=>i.creatives.find(e=>e.mediaFiles),qE=i=>{var e;const t=i==null?void 0:i.mediaFiles;return t!=null&&t.length&&((e=t.find(r=>r.fileURL))==null?void 0:e.fileURL)||""},Rs=El.a({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),HE=(i,e)=>{const[t,r]=Se.useState(),s=Se.useRef(Date.now()),n=Se.useRef(Date.now());return Se.useEffect(()=>{if(!e||!(i!=null&&i.current))return;const a=$E(i.current,e),l=Date.now();s.current=l,Rs.set({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),a().then(u=>{s.current===l&&u&&(r(u.url),Rs.set({ads:[],autoplay:!0,muted:!1,nonceManager:u.manager}))}).catch(u=>{console.error(u)})},[i,e]),Se.useEffect(()=>{const a=async(l,u)=>{let f=[];if(l.searchParams.get("output")==="vmap"){const S=await fetch(l.toString()),A=new DOMParser,v=await S.text(),L=A.parseFromString(v,"text/xml");f=new FE(L).adBreaks.map(P=>P.adSource.adTagURI.uri)}else f=[l.toString()];const p=await Promise.all(f.map((S,A)=>jE.get(S).then(v=>{if(n.current===u){const L=v.ads.find(O=>O.creatives.length>0);if(!L)return;const P=VE(L),M=qE(P);return{creative:P,order:A,mediaFileUrl:M,ad:L,raw:v}}}))),T=l.searchParams.get("vpa")!=="click",b=l.searchParams.get("vpmute")==="1";Rs.set({...Rs.get(),ads:p.filter(S=>!!S),autoplay:T,muted:b})};if(t){const l=Date.now();n.current=l,a(t,l)}return()=>{n.current=0}},[t]),Rs},zE=i=>{const e=Se.useRef();return Se.useEffect(()=>{if(!e.current&&i.current){const t=document.createElement("video-js");t.classList.add("vjs-big-play-centered"),i.current.appendChild(t),e.current=F(t,{controls:!1,playsinline:!0})}return()=>{e.current&&(e.current.dispose(),e.current=void 0)}},[]),e},pg={time:0,adCount:0,adPosition:0,skipDelay:0,playing:!1,paused:!1,reset:()=>{},whyThisAd:null,hasAdUrl:!1,adAction:i=>{},playMuted:!1,muted:!1,autoplay:!0},Re=El.f(pg),ph=i=>{if(!i)return 0;const e=i.duration(),t=i.currentTime();return e===void 0||isNaN(e)||t===void 0||isNaN(t)?0:Math.round(e-t)},WE=(i,e)=>{const t=HE(i,e),r=zE(i),s=Se.useRef(),n=Se.useRef(!1),a=Se.useRef(!1),l=Se.useCallback(()=>{if(a.current)return;const S=t.get().nonceManager;if(S&&n.current)try{S.sendPlaybackEnd()}catch(A){console.warn("[PAL] sendPlaybackEnd failed",A)}a.current=!0},[t]),u=Se.useCallback(()=>{l(),r.current&&(r.current.pause(),r.current.src(void 0)),s.current=void 0,Re.set({...pg,reset:u})},[r,l]);Se.useEffect(()=>{Re.setKey("reset",u)},[u]);const f=Se.useCallback(()=>{var S,A,v;const{adPosition:L,adCount:P}=Re.get();if(r.current){if(L<P){const M=L+1,{ads:O,muted:U,autoplay:R,nonceManager:q}=t.get(),Y=O[M-1];if(Y){(S=s.current)==null||S.complete(),s.current=new fT(null,Y.ad,Y.creative),s.current.on("clickthrough",K=>{if(q)try{q.sendAdClick()}catch(ie){console.warn("[PAL] sendAdClick failed",ie)}window.open(K,"_blank")}),Re.setKey("adPosition",M),Re.setKey("playMuted",U),Re.setKey("skipDelay",Y.creative.skipDelay||0),Re.setKey("time",0),Re.setKey("adAction",K=>{s.current&&s.current.click(null,{CLICKPOS:[K.clientX,K.clientY]})}),Re.setKey("whyThisAd",Y.creative.icons.find(K=>K.program==="GoogleWhyThisAd")||null),Re.setKey("hasAdUrl",!!((A=Y.creative.videoClickThroughURLTemplate)!=null&&A.url)),r.current.src(Y.mediaFileUrl),Re.setKey("playing",!0),L===0?(Re.setKey("muted",U),Re.setKey("autoplay",R),U&&r.current.muted(!0),R?r.current.play():(r.current.pause(),Re.setKey("paused",!0))):r.current.play();return}}(v=s.current)==null||v.complete(),u()}},[r,u,t]),p=Se.useCallback(()=>{if(!r.current)return;const S=r.current.muted();r.current.muted(!S),Re.setKey("muted",!S),s.current&&s.current.setMuted(!S)},[r]),T=Se.useCallback(()=>{r.current&&(r.current.paused()?(r.current.play(),s.current&&s.current.setPaused(!1)):(r.current.pause(),s.current&&s.current.setPaused(!0)))},[r]),b=Se.useCallback(()=>{r.current&&(s.current&&s.current.skip(),f())},[f,r]);return Se.useEffect(()=>{const S=r.current;if(!S)return()=>{};const A=R=>{if(Re.setKey("playing",!0),Re.setKey("paused",!1),Re.setKey("time",ph(R.target.player)),!n.current){const q=t.get().nonceManager;if(q)try{q.sendPlaybackStart(),n.current=!0,a.current=!1}catch(Y){console.warn("[PAL] sendPlaybackStart failed",Y)}}},v=()=>{var R;(R=s.current)==null||R.complete(),f()},L=R=>{Re.setKey("muted",R.target.player.muted())},P=()=>{Re.setKey("paused",!0)},M=R=>{R.target.tagName==="VIDEO"&&(Re.get().autoplay||T())},O=R=>{Re.setKey("time",ph(R.target.player)),s.current&&s.current.setProgress(R.target.player.currentTime())},U=()=>{u()};return S.on("play",A),S.on("ended",v),S.on("muted",L),S.on("pause",P),S.on("click",M),S.on("timeupdate",O),S.on("error",U),()=>{S.off("play",A),S.off("ended",v),S.off("muted",L),S.off("pause",P),S.off("click",M),S.off("timeupdate",O),S.off("error",U)}},[T,f,r,u,t]),Se.useEffect(()=>t.subscribe(S=>{S&&(n.current=!1,a.current=!1,Re.setKey("adCount",S.ads.length),Re.setKey("adPosition",0),f())}),[t,r,f]),Se.useEffect(()=>()=>{u()},[u]),[Re,p,T,b,s]},GE=({promotion:i,onClose:e,promotionId:t,externalAd:r,skipAutoClose:s})=>{var n,a,l,u,f;const p=Se.useRef(null),[T,b,S,A]=WE(p,r==null?void 0:r.url),{time:v,adCount:L,adPosition:P,skipDelay:M,playing:O,paused:U,reset:R,muted:q,playMuted:Y,autoplay:K,whyThisAd:ie,hasAdUrl:me,adAction:le}=J.useStore(T),ge=((n=i.sponsor)==null?void 0:n.logo)&&i.logoMode===oe.PromotionLogoMode.CENTER;return G.jsxs(Sh,{className:"PromoOverlay",children:[G.jsxs(Eh,{children:[G.jsx(Ch,{className:J.cx_default(!ge&&Ah),children:G.jsx(Dh,{style:{transform:"scale(1.5)"},children:"Ad"})}),G.jsxs(X_,{children:[G.jsx($_,{time:v,adCount:L,adPosition:P}),!!M&&O&&G.jsx(Jn.y,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{A()},duration:M,isPlaying:!U,skipIcon:!0}),s&&G.jsx(Jn.y,{className:"ClosePromoIcon",close:()=>{R(),e==null||e()}})]})]}),G.jsx(wh,{className:J.cx_default(xc,O&&Sc,!O&&Ec),children:G.jsxs(K_,{ref:p,children:[ie&&G.jsx(V_,{whyThisAd:ie}),G.jsxs(q_,{style:(ie==null?void 0:ie.xPosition)==="right"?{left:"8px"}:{right:"8px"},children:[Y&&G.jsx(z_,{className:J.cx_default(!q&&"muted"),onClick:()=>b()}),U&&!K&&G.jsx(G_,{onClick:()=>S()})]})]})}),me&&G.jsx(Ih,{className:J.cx_default(xc,O&&Sc,!O&&Ec),children:G.jsx(kh,{as:"button",onClick:le,style:{backgroundColor:((l=(a=i.banner)==null?void 0:a.ctaButton)==null?void 0:l.color)||"#009dc4",color:((f=(u=i.banner)==null?void 0:u.ctaButton)==null?void 0:f.textColor)||"#fff"},"data-a":"button","data-promo-id":t,"data-promo-type":i.type,target:"_blank",children:"Show more"})})]})},mh=i=>{var e,t,r,s,n,a,l,u,f,p,T,b,S,A,v,L,P,M,O,U,R,q,Y,K,ie,me,le,ge,ee,ce;const{promotion:te,open:de,advertisementPaused:ve,togglePause:Ve,controlVideo:Ye,skipAutoClose:Ce,promotionId:_e,onClose:St,markAsViewed:Pt,externalAd:Ie,isEventFired:pe,fireEvent:qe,muted:dr}=i,Ai=te.type===oe.PromotionType.INGAME_IAB11_LBAR||te.type===oe.PromotionType.INGAME_IAB11||te.type===oe.PromotionType.INGAME_IAB11_SIDEBAR,wi=((e=te.sponsor)==null?void 0:e.logo)&&te.logoMode===oe.PromotionLogoMode.CENTER,zi=!!((r=(t=te.banner)==null?void 0:t.video)!=null&&r.url),Et=te.autoPlayVideo===oe.AutoPlayVideo.ENABLED,Di=te.playVideoMuted===oe.PlayVideoMuted.ENABLED;if(Se.useEffect(()=>{Ve==null||Ve(zi||Et),de==null||de()},[]),Se.useEffect(()=>{_e&&te.type&&Pt&&Pt()},[_e,te.type,Pt]),Se.useEffect(()=>()=>{Ye==null||Ye({muted:!1})},[Ye]),Ie)return G.jsx(GE,{...i,externalAd:Ie});let Xt=(s=te.banner)==null?void 0:s.url;Xt&&Xt.indexOf("http")!==0&&(Xt=`https://${Xt}`);let Wi=!0;return zi&&(!ve||!Et?Wi=!0:Wi=!1),G.jsxs(Sh,{className:"PromoOverlay",children:[G.jsxs("div",{children:[G.jsxs(Eh,{children:[G.jsxs(Ch,{className:J.cx_default(!wi&&Ah),children:[((n=te.sponsor)==null?void 0:n.logo)&&te.logoMode===oe.PromotionLogoMode.LEFT&&G.jsx(Tc,{className:"PromoSponsorLogo",src:(a=te.sponsor)==null?void 0:a.logo,alt:"promo"}),G.jsxs(R_,{style:{paddingLeft:(l=te.sponsor)!=null&&l.logo&&te.logoMode===oe.PromotionLogoMode.LEFT?"0px":"8px"},children:[((u=te.sponsor)==null?void 0:u.logo)&&te.logoMode===oe.PromotionLogoMode.LEFT&&G.jsx(I_,{children:(f=te.sponsor)==null?void 0:f.name}),G.jsxs(O_,{className:"SponsorText",children:[G.jsx(Dh,{children:"AD"}),G.jsx(N_,{children:"SPONSORED"})]})]})]}),G.jsx(Jn.y,{className:"ClosePromoIcon",close:St,autoClose:(p=te.closeTimer)==null?void 0:p.auto,duration:Ce?0:(T=te.closeTimer)==null?void 0:T.seconds,isPlaying:Wi})]}),G.jsxs(wh,{children:[wi&&G.jsx(Tc,{className:P_,src:(b=te.sponsor)==null?void 0:b.logo,alt:"promo"}),G.jsx(vc,{children:(A=(S=te.banner)==null?void 0:S.video)!=null&&A.url?G.jsx(Jn.Et,{source:(L=(v=te.banner)==null?void 0:v.video)==null?void 0:L.url,poster:(M=(P=te.banner)==null?void 0:P.video)==null?void 0:M.thumbnailUrl,aspectRatio:Ai?"1/1":"2/1",onRender:()=>{pe!=null&&pe("video-rendered")||(ei.eventBus.emit("advertisement",{action:"videoRendered",payload:{id:_e,type:te.type}}),qe==null||qe("video-rendered"))},onQuartile:jt=>{pe!=null&&pe(`video-quartile-${jt}`)||(ei.eventBus.emit("advertisement",{action:"quartileCompleted",payload:{id:_e,type:te.type,quartile:jt}}),qe==null||qe(`video-quartile-${jt}`))},onMute:jt=>{const Vt=jt?"muted":"unmuted";pe!=null&&pe(Vt)||(ei.eventBus.emit("advertisement",{action:jt?"videoMuted":"videoUnmuted",payload:{id:_e,type:te.type}}),qe==null||qe(Vt))},onPause:()=>{Et&&(Ve==null||Ve(!0))},onReplay:()=>{pe!=null&&pe("replayed")||(ei.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:_e,type:te.type}}),qe==null||qe("replayed"))},onPlay:()=>{pe!=null&&pe("played")||(ei.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:_e,type:te.type}}),qe==null||qe("played")),Ve==null||Ve(!1),pe!=null&&pe("played")&&pe!=null&&pe("ended")&&!(pe!=null&&pe("replayed"))&&(ei.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:_e,type:te.type}}),qe==null||qe("replayed"))},onEnd:()=>{pe!=null&&pe("ended")||(ei.eventBus.emit("advertisement",{action:"videoEnd",payload:{id:_e,type:te.type}}),qe==null||qe("ended"))},controlVideo:Ye,autoPlay:Et,playMuted:Di,muted:dr}):(O=te.banner)!=null&&O.imageUrl?G.jsx(k_,{style:Ai?{aspectRatio:"1/1"}:{},src:(U=te.banner)==null?void 0:U.imageUrl,alt:"promo"}):null}),!Ai&&G.jsxs(vc,{children:[((R=te.banner)==null?void 0:R.title)&&G.jsx(B_,{className:J.cx_default("AdvTitle",wi&&M_),children:(q=te.banner)==null?void 0:q.title}),((Y=te.banner)==null?void 0:Y.body)&&G.jsx(L_,{className:"AdvDescription",children:(K=te.banner)==null?void 0:K.body})]})]})]}),te.buttonType===oe.PromotionButtonType.BASIC&&G.jsx(Ih,{children:G.jsx(kh,{href:Xt,style:{backgroundColor:((me=(ie=te.banner)==null?void 0:ie.ctaButton)==null?void 0:me.color)||"#009dc4",color:((ge=(le=te.banner)==null?void 0:le.ctaButton)==null?void 0:ge.textColor)||"#fff"},"data-a":"button","data-promo-id":_e,"data-promo-type":te.type,target:"_blank",children:(ce=(ee=te.banner)==null?void 0:ee.ctaButton)==null?void 0:ce.label})})]})},KE=J.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),XE=({children:i,direction:e,style:t,className:r,hiding:s})=>G.jsx(Cl,{direction:e,style:t,hiding:s,className:r,children:G.jsx(KE,{children:i})}),gh=i=>(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB11_LBAR||(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB21_LBAR,YE=i=>(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB11_SIDEBAR||(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB21_SIDEBAR,QE=i=>(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB11||(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB21,JE=({advertisement:i,close:e,skipTypeCheck:t,skipAutoClose:r,layoutMode:s="side-by-side",sidebar:n,isNotification:a,banner:l,markAsViewed:u,open:f,externalAd:p,controlVideo:T,advertisementPaused:b,togglePause:S,isEventFired:A,fireEvent:v,muted:L})=>i.promotion?a&&i.notification?G.jsx(w_,{open:()=>f==null?void 0:f({fromNotification:!0}),notification:i.notification,promotionId:i.question.id,close:e}):!n&&!l&&(t||QE(i.promotion))?G.jsx(D_,{className:"PromoOverlayContainer",children:G.jsx(mh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,onClose:e,open:f,skipAutoClose:r,externalAd:p,controlVideo:T,advertisementPaused:b,togglePause:S,isEventFired:A,fireEvent:v,muted:L})}):n&&(t||gh(i.promotion)||YE(i.promotion)||p)?G.jsx(XE,{className:"PromoSidebarContainer",direction:n,hiding:!1,children:G.jsx(mh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,externalAd:p,onClose:e,open:f,controlVideo:T,skipAutoClose:r,advertisementPaused:b,togglePause:S,isEventFired:A,fireEvent:v,muted:L})}):l&&gh(i.promotion)?G.jsx(_h,{promotionId:i.question.id,hiding:!1,promotion:i.promotion,direction:l,isEventFired:A,fireEvent:v}):null:null,yh=J.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),ZE=i=>{const e=i.target;if(e instanceof HTMLAnchorElement&&e.target==="_blank"){const t=e.getAttribute("data-promo-id")||"",r=e.getAttribute("data-promo-type")||oe.PromotionType.UNSET;e.getAttribute("data-a")==="button"&&ei.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:r}}),e.getAttribute("data-a")==="banner"&&ei.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:r}})}},eC=({gamification:i,advertisement:e,layoutMode:t,skipAutoClose:r,skipTypeCheck:s,sidebar:n,banner:a,notification:l,isMobileScreen:u,persistent:f,containerId:p,externalAd:T,controlVideo:b,muted:S})=>{var A,v,L,P,M,O,U,R,q,Y,K,ie,me,le,ge,ee,ce,te,de,ve,Ve;const Ye=Se.useRef(null),Ce=J.useStore(e.$store),_e=J.useStore(i.openedQuestion.$store);El.b(Ye,{enabled:!!Ce.data,event:"click",listener:ZE});const St=((L=(v=(A=Ce.data)==null?void 0:A.question)==null?void 0:v.backgroundImage)==null?void 0:L.landscapeUrl)||((M=(P=Ce.data)==null?void 0:P.promotion)==null?void 0:M.backgroundImageLandscapeUrl),Pt=((R=(U=(O=Ce.data)==null?void 0:O.question)==null?void 0:U.backgroundImage)==null?void 0:R.portraitUrl)||((Y=(q=Ce.data)==null?void 0:q.promotion)==null?void 0:Y.backgroundImagePortraitUrl),Ie=Sy.y({containerId:p,landscapeUrl:St,portraitUrl:Pt});if(((K=_e==null?void 0:_e.attributes)==null?void 0:K.adUnit)===oe.AdUnit.STANDART&&(le=(me=(ie=_e==null?void 0:_e.attributes)==null?void 0:ie.adPromotion)==null?void 0:me.banner)!=null&&le.imageUrl)return a?G.jsx(yh,{ref:Ye,style:{height:"100%"},className:J.cx_default("SL-AdvertisementUIWrap",u&&"mobile-view"),children:G.jsx(My,{cardId:_e.id,promotion:{...(ge=_e==null?void 0:_e.attributes)==null?void 0:ge.adPromotion,adUnit:(ee=_e==null?void 0:_e.attributes)==null?void 0:ee.adUnit}})}):null;const pe=!a&&!n;if(Ce.data===void 0||!f&&Ce.isViewed)return null;const qe=((de=(te=(ce=Ce==null?void 0:Ce.data)==null?void 0:ce.notification)==null?void 0:te.promotion)==null?void 0:de.mode)===oe.NotificationPromotionMode.LOWER_THIRD;return G.jsxs(yh,{ref:Ye,style:{height:pe?"auto":"100%"},className:J.cx_default("SL-AdvertisementUIWrap",u&&"mobile-view",qe&&"SL-AdvertisementUIWrap--lower-third"),children:[!l&&Ie,G.jsx(JE,{skipTypeCheck:s,sidebar:n,banner:a,advertisement:Ce.data,advertisementPaused:!!Ce.isPaused,togglePause:Ce.togglePause,isEventFired:Ce.isEventFired,fireEvent:Ce.fireEvent,close:Ce.close,externalAd:T?Ce.externalAd:void 0,markAsViewed:(ve=i.advertisement)==null?void 0:ve.markAsViewed,open:(Ve=i.advertisement)==null?void 0:Ve.open,layoutMode:t,isNotification:l,skipAutoClose:r,controlVideo:b,muted:S})]})},mg=({sdk:i,sidebar:e,externalAd:t,banner:r,skipAutoClose:s,skipTypeCheck:n,layoutMode:a,isMobileScreen:l,persistent:u,notification:f,muted:p})=>{const T=J.useStore(i.featuresList.getStore()),[b,S]=Se.useState(!t),A=J.useStore(i.options);if(Se.useEffect(()=>{if(t){const L=document.createElement("script");L.async=!0,L.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(L),L.onload=()=>{S(!0)}}},[t]),e&&r)return G.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(r&&t)return G.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!T)return null;const v=i.getFeature(oe.SdkOverlayType.GAMES);return!(v!=null&&v.advertisement)||t&&!b?null:G.jsx(eC,{gamification:v,advertisement:v.advertisement,sidebar:e,banner:r,layoutMode:a,isMobileScreen:l,persistent:u,notification:f,skipTypeCheck:n,skipAutoClose:s,externalAd:t,controlVideo:i.controlVideoPlayer,containerId:A.containerId,muted:p})},tC=({event:i,sidebar:e,banner:t,isMobileScreen:r,skipAutoClose:s,persistent:n,theme:a,notification:l,skipTypeCheck:u,externalAd:f,muted:p=!1})=>{const T=Jt.B(),b=Jt.F(),S=Jt.z();return T?f&&!b.promotionExternalAd?i!==void 0&&G.jsx(Jt.j,{event:i}):!f&&b.promotionExternalAd?i!==void 0&&G.jsx(Jt.j,{event:i}):e&&!b.promotionSidebar?i!==void 0&&G.jsx(Jt.j,{event:i}):t&&!b.promotionBanner?i!==void 0&&G.jsx(Jt.j,{event:i}):l&&!b.promotionNotification?i!==void 0&&G.jsx(Jt.j,{event:i}):!t&&!e&&!l&&!b.promotionOverlay&&!u?i!==void 0&&G.jsx(Jt.j,{event:i}):G.jsxs("div",{className:"StreamLayerSDK",children:[G.jsx(by.h,{customTheme:a??S.theme,themeMode:S.themeMode,children:G.jsx(mg,{sdk:T,sidebar:e,banner:t,isMobileScreen:r,persistent:n,notification:l,skipTypeCheck:u,skipAutoClose:s,layoutMode:"side-by-side",externalAd:f,muted:p})}),i!==void 0&&G.jsx(Jt.j,{event:i})]}):null};exports.StreamLayerSDKAdvertisement=tC;exports.StreamLayerSDKAdvertisementUI=mg;
1
+ "use strict";require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.symbol.to-primitive.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.copy-within.js"),require("core-js/modules/es.array.fill.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.array.find.js"),require("core-js/modules/es.array.find-index.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.array.index-of.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.array.last-index-of.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.reduce.js"),require("core-js/modules/es.array.reduce-right.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.array.sort.js"),require("core-js/modules/es.array.splice.js"),require("core-js/modules/es.date.to-primitive.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.map.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.number.constructor.js"),require("core-js/modules/es.number.is-integer.js"),require("core-js/modules/es.number.max-safe-integer.js"),require("core-js/modules/es.object.assign.js"),require("core-js/modules/es.object.define-properties.js"),require("core-js/modules/es.object.define-property.js"),require("core-js/modules/es.object.entries.js"),require("core-js/modules/es.object.freeze.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.object.get-own-property-names.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.object.values.js"),require("core-js/modules/es.parse-float.js"),require("core-js/modules/es.parse-int.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.promise.finally.js"),require("core-js/modules/es.reflect.construct.js"),require("core-js/modules/es.reflect.get.js"),require("core-js/modules/es.regexp.constructor.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.regexp.flags.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.set.js"),require("core-js/modules/es.string.ends-with.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/es.string.match.js"),require("core-js/modules/es.string.pad-start.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.string.split.js"),require("core-js/modules/es.string.starts-with.js"),require("core-js/modules/es.string.trim.js"),require("core-js/modules/es.typed-array.int32-array.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/es.typed-array.uint16-array.js"),require("core-js/modules/es.typed-array.uint32-array.js"),require("core-js/modules/es.typed-array.copy-within.js"),require("core-js/modules/es.typed-array.every.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.filter.js"),require("core-js/modules/es.typed-array.find.js"),require("core-js/modules/es.typed-array.find-index.js"),require("core-js/modules/es.typed-array.for-each.js"),require("core-js/modules/es.typed-array.includes.js"),require("core-js/modules/es.typed-array.index-of.js"),require("core-js/modules/es.typed-array.iterator.js"),require("core-js/modules/es.typed-array.join.js"),require("core-js/modules/es.typed-array.last-index-of.js"),require("core-js/modules/es.typed-array.map.js"),require("core-js/modules/es.typed-array.of.js"),require("core-js/modules/es.typed-array.reduce.js"),require("core-js/modules/es.typed-array.reduce-right.js"),require("core-js/modules/es.typed-array.reverse.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.slice.js"),require("core-js/modules/es.typed-array.some.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.typed-array.to-string.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/esnext.global-this.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url.to-json.js"),require("core-js/modules/web.url-search-params.js");function e(n){var i="function"==typeof Map?new Map:void 0;return e=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,n)}function n(){return t(e,arguments,p(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),m(n,e)},e(n)}function t(e,t,n){if(h())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,t);var r=new(e.bind.apply(e,i));return n&&m(r,n.prototype),r}function n(e,t,n,r){var a=i(p(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof a?function(e){return a.apply(n,e)}:a}function i(){return i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(arguments.length<3?e:n):r.value}},i.apply(null,arguments)}function r(){
2
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
+ var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",s=n.toStringTag||"@@toStringTag";function o(n,i,r,s){var o=i&&i.prototype instanceof l?i:l,c=Object.create(o.prototype);return a(c,"_invoke",function(n,i,r){var a,s,o,l=0,c=r||[],d=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,o=e,h.n=n,u}};function p(n,i){for(s=n,o=i,t=0;!d&&l&&!r&&t<c.length;t++){var r,a=c[t],p=h.p,f=a[2];n>3?(r=f===i)&&(o=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((r=n<2&&p<a[1])?(s=0,h.v=i,h.n=a[1]):p<f&&(r=n<3||a[0]>i||i>f)&&(a[4]=n,a[5]=i,h.n=f,s=0))}if(r||n>1)return u;throw d=!0,i}return function(r,c,f){if(l>1)throw TypeError("Generator is already running");for(d&&1===c&&p(c,f),s=c,o=f;(t=s<2?e:o)||!d;){a||(s?s<3?(s>1&&(h.n=-1),p(s,o)):h.n=o:h.v=o);try{if(l=2,a){if(s||(r="next"),t=a[r]){if(!(t=t.call(a,o)))throw TypeError("iterator result is not an object");if(!t.done)return t;o=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(o=TypeError("The iterator does not provide a '"+r+"' method"),s=1);a=e}else if((t=(d=h.n<0)?o:n.call(i,h))!==u)break}catch(m){a=e,s=1,o=m}finally{l=1}}return{value:t,done:d}}}(n,r,s),!0),c}var u={};function l(){}function c(){}function d(){}t=Object.getPrototypeOf;var h=[][i]?t(t([][i]())):(a(t={},i,function(){return this}),t),p=d.prototype=l.prototype=Object.create(h);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,a(e,s,"GeneratorFunction")),e.prototype=Object.create(p),e}return c.prototype=d,a(p,"constructor",d),a(d,"constructor",c),c.displayName="GeneratorFunction",a(d,s,"GeneratorFunction"),a(p),a(p,s,"Generator"),a(p,i,function(){return this}),a(p,"toString",function(){return"[object Generator]"}),(r=function(){return{w:o,m:f}})()}function a(e,t,n,i){var r=Object.defineProperty;try{r({},"",{})}catch(s){r=0}(a=function(e,t,n,i){function s(t,n){a(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(s("next",0),s("throw",1),s("return",2))})(e,t,n,i)}function s(e,t,n,i,r,a,s){try{var o=e[a](s),u=o.value}catch(l){return void n(l)}o.done?t(u):Promise.resolve(u).then(i,r)}function o(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var a=e.apply(t,n);function o(e){s(a,i,r,o,u,"next",e)}function u(e){s(a,i,r,o,u,"throw",e)}o(void 0)})}}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){I(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return t=p(t),d(e,h()?Reflect.construct(t,n||[],p(e).constructor):t.apply(e,n))}function d(e,t){if(t&&("object"==k(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(h=function(){return!!e})()}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}function m(e,t){return(m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,x(i.key),i)}}function y(e,t,n){return t&&v(e.prototype,t),n&&v(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=E(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){o=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(o)throw a}}}}function b(e){return function(e){if(Array.isArray(e))return C(e)}(e)||T(e)||E(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function k(e){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){return A(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,a,s,o=[],u=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(i=a.call(n)).done)&&(o.push(i.value),o.length!==t);u=!0);}catch(c){l=!0,r=c}finally{try{if(!u&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw r}}return o}}(e,t)||E(e,t)||w()}function w(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function E(e,t){if(e){if("string"==typeof e)return C(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function A(e){if(Array.isArray(e))return e}function I(e,t,n){return(t=x(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function x(e){var t=function(e,t){if("object"!=k(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=k(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==k(t)?t:t+""}Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var L=require("react/jsx-runtime"),D=require("./index7.js"),P=require("./sl-types.js"),R=require("./analytics.js"),O=require("react"),N=require("./index5.js"),U=require("./useStreamLayerApp2.js"),M=require("./index10.js"),B=require("./index4.js"),j=require("./index9.js"),F=require("./index11.js"),q=require("./utils.js"),V=require("./hooks-WfHlJH12.js"),H=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function z(e){return"string"==typeof e&&H.test(e)}function W(e){if(!z(e))throw TypeError("Invalid UUID");var t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}function G(e,t,n,i,r,a){var s,o="string"==typeof n?function(e){e=unescape(encodeURIComponent(e));for(var t=new Uint8Array(e.length),n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}(n):n,u="string"==typeof i?W(i):i;if("string"==typeof i&&(i=W(i)),16!==(null===(s=i)||void 0===s?void 0:s.length))throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var l=new Uint8Array(16+o.length);if(l.set(u),l.set(o,u.length),(l=t(l))[6]=15&l[6]|e,l[8]=63&l[8]|128,r){a=a||0;for(var c=0;c<16;++c)r[a+c]=l[c];return r}return U.unsafeStringify(l)}function X(e,t,n,i){switch(e){case 0:return t&n^~t&i;case 1:case 3:return t^n^i;case 2:return t&n^t&i^n&i}}function K(e,t){return e<<t|e>>>32-t}function Y(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],i=new Uint8Array(e.length+1);i.set(e),i[e.length]=128;for(var r=(e=i).length/4+2,a=Math.ceil(r/16),s=new Array(a),o=0;o<a;++o){for(var u=new Uint32Array(16),l=0;l<16;++l)u[l]=e[64*o+4*l]<<24|e[64*o+4*l+1]<<16|e[64*o+4*l+2]<<8|e[64*o+4*l+3];s[o]=u}s[a-1][14]=8*(e.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(e.length-1)&4294967295;for(var c=0;c<a;++c){for(var d=new Uint32Array(80),h=0;h<16;++h)d[h]=s[c][h];for(var p=16;p<80;++p)d[p]=K(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var f=n[0],m=n[1],g=n[2],v=n[3],y=n[4],_=0;_<80;++_){var b=Math.floor(_/20),T=K(f,5)+X(b,m,g,v)+y+t[b]+d[_]>>>0;y=v,v=g,g=K(m,30)>>>0,m=f,f=T}n[0]=n[0]+f>>>0,n[1]=n[1]+m>>>0,n[2]=n[2]+g>>>0,n[3]=n[3]+v>>>0,n[4]=n[4]+y>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function Q(e,t,n,i){return G(80,Y,e,t,n,i)}function $(){return $=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},$.apply(null,arguments)}Q.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Q.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";var J=P.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),Z=function(e){return"left"===e||"right"===e?"s35f1di":"b12050d8"},ee=function(e){return"left"===e||"right"===e?"sj4471g":"b1d5ybek"},te=function(e){return"left"===e?"avdxyl3":"right"===e?"a1bisd08":"top"===e?"a1u9y2aj":"a1qqaks"},ne=function(e){var t=e.children,n=e.style,i=e.className,r=e.enabled,a=void 0===r||r,s=e.hiding,o=e.direction,u=void 0===o?"left":o,l=e.onAnimationEnd;return L.jsx(J,{style:n,className:P.cx_default(i,"a1rlj479",te(u),a&&!s&&Z(u),a&&s&&ee(u)),onAnimationEnd:l,children:t})},ie=P.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),re=P.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),ae=P.styled_default(ie)({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),se=function(e){var t=e.promotion,n=e.promotionId,i=e.hiding,r=e.isEventFired,a=e.fireEvent,s=e.direction,o=void 0===s?"bottom":s,u=(null==t?void 0:t.adUnit)===U.AdUnit.STANDART,l=u?t.banner:t.additionalBanner;if(O.useEffect(function(){null!=l&&l.imageUrl&&t.type&&n&&(null!=r&&r("banner-showed")||(N.eventBus.emit("advertisement",{action:"bannerShown",payload:{id:n,type:t.type}}),null==a||a("banner-showed")))},[null==l?void 0:l.imageUrl,a,r,t.type,n]),null==l||!l.imageUrl)return null;var c=null==l?void 0:l.url;return c&&0!==c.indexOf("http")&&(c="https://".concat(c)),L.jsx(ne,{direction:o,hiding:i,children:L.jsx(re,{className:"BannerContainer","data-is-ad":u,children:L.jsx(ae,{as:c?"a":"span",className:"BannerLink",href:c,style:{backgroundImage:"url(".concat(l.imageUrl,")"),cursor:c?"pointer":"default"},"data-promo-id":n,"data-promo-type":t.type,"data-a":"banner",target:"_blank","data-is-ad":u})})})},oe=function(e){var t=e.cardId,n=e.promotion,i=e.direction,r=void 0===i?"bottom":i;return L.jsx(se,{promotion:n,promotionId:t,direction:r,hiding:!1})},ue=P.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),le=P.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),ce=P.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),de=P.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),he=P.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),pe=P.styled_default(he)({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),fe=P.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),me=P.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),ge=P.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),ve=P.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),ye=P.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),_e=P.styled_default("button")({name:"TVButton",class:"tkkfuqy",propsAsIs:!1}),be=P.styled_default(_e)({name:"DismissButton",class:"dh9vato",propsAsIs:!0}),Te=P.styled_default(_e)({name:"OpenButton",class:"oeah8gv",propsAsIs:!0}),ke=I(I(I(I(I(I({},U.NotificationPromotionImagePosition.UNSET,he),U.NotificationPromotionImagePosition.FIT,he),U.NotificationPromotionImagePosition.CENTERED,he),U.NotificationPromotionImagePosition.SOLID,he),U.NotificationPromotionImagePosition.BOTTOM,he),U.NotificationPromotionImagePosition.MIDDLE,pe),Se=function(e){var t=e.src,n=e.imagePosition,i=ke[n];return L.jsx(i,{children:L.jsx("img",{src:t,alt:""})})},we=M.O(be),Ee=M.O(Te),Ce=function(e){var t=e.notification,n=e.open,i=e.close,r=e.webos;if(!t||!t.promotion||t.enabled!==U.NotificationEnabled.NOTIFICATION_ENABLED)return null;var a=t.title,s=t.body,o=t.image,u=t.promotion,l=u.sponsorLogo,c=u.sponsorLogoMode,d=u.imagePosition,h=u.ctaButton;return L.jsxs(ye,{"data-webos":r,className:"SL_Lower_Third_Notification",onClick:r?void 0:n,children:[L.jsxs(ue,{children:[L.jsx(Se,{src:o,imagePosition:d}),L.jsxs(le,{children:[a&&L.jsx(ce,{children:a}),s&&L.jsx(de,{children:s})]})]}),L.jsxs(ge,{children:[c!==U.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&L.jsxs(L.Fragment,{children:[L.jsx(me,{children:L.jsx("img",{src:l,alt:a})}),L.jsx(ve,{})]}),r?L.jsxs(L.Fragment,{children:[L.jsx(we,{webos:!0,onClick:i,children:"Dismiss"}),L.jsxs(Ee,{webos:!0,autoFocus:!0,style:{color:null==h?void 0:h.textColor,backgroundColor:null==h?void 0:h.color},onClick:n,children:[(null==h?void 0:h.ctaIcon)&&(null==h?void 0:h.ctaIconMode)===U.CtaIconMode.CTA_ICON_TRANSPARENT&&L.jsx(fe,{src:null==h?void 0:h.ctaIcon,alt:"cta-icon"}),(null==h?void 0:h.label)||"Open"]})]}):L.jsxs(Te,{name:"promo-button",style:{color:null==h?void 0:h.textColor,backgroundColor:null==h?void 0:h.color},children:[(null==h?void 0:h.ctaIcon)&&(null==h?void 0:h.ctaIconMode)===U.CtaIconMode.CTA_ICON_TRANSPARENT&&L.jsx(fe,{src:null==h?void 0:h.ctaIcon,alt:"cta-icon"}),(null==h?void 0:h.label)||"Open"]})]})]})},Ae=P.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),Ie=P.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),xe=P.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),Le=P.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),De=P.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),Pe=P.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),Re=P.styled_default(Pe)({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),Oe=P.styled_default(Pe)({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),Ne=P.styled_default(Oe)({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),Ue=P.styled_default(Pe)({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),Me=P.styled_default(Pe)({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),Be=P.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),je=P.styled_default(B.B1)({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),Fe=P.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),qe=P.styled_default("button")({name:"TVButton",class:"thdqfl0",propsAsIs:!1}),Ve=P.styled_default(qe)({name:"DismissButton",class:"d11pe8bx",propsAsIs:!0}),He=P.styled_default(qe)({name:"OpenButton",class:"oy9k0kp",propsAsIs:!0}),ze=I(I(I(I(I(I({},U.NotificationPromotionImagePosition.UNSET,Re),U.NotificationPromotionImagePosition.FIT,Re),U.NotificationPromotionImagePosition.CENTERED,Oe),U.NotificationPromotionImagePosition.BOTTOM,Ne),U.NotificationPromotionImagePosition.SOLID,Ue),U.NotificationPromotionImagePosition.MIDDLE,Me),We=function(e){var t=e.src,n=e.imagePosition,i=ze[n];return L.jsx(i,{children:L.jsx("img",{src:t,alt:""})})},Ge=M.O(Ve),Xe=M.O(He),Ke=function(e){var t=e.notification,n=e.open,i=(e.promotionId,e.hiding),r=e.direction,a=void 0===r?"left":r,s=e.close,o=e.webos;if(!t||!t.promotion||t.enabled!==U.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(t.promotion.mode===U.NotificationPromotionMode.LOWER_THIRD)return L.jsx(Ce,{notification:t,open:n,close:s,webos:o});var u=t.title,l=t.body,c=t.image,d=t.promotion,h=d.sponsorLogo,p=d.sponsorLogoMode,f=d.imagePosition,m=d.ctaButton;return L.jsx(ne,{className:"SL_Rich_Notification",direction:a,hiding:i,children:L.jsxs(Ie,{onClick:o?function(){}:n,children:[p!==U.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&h&&L.jsx(Fe,{children:L.jsx("img",{src:h,alt:u})}),L.jsxs(Ae,{children:[L.jsx(We,{src:c,imagePosition:f}),L.jsxs(xe,{children:[u&&L.jsx(Le,{children:u}),l&&L.jsx(De,{children:l})]}),o&&L.jsx(Ge,{webos:!0,onClick:function(e){e.stopPropagation(),null==s||s()},children:"Dismiss"}),L.jsxs(Xe,{webos:o,autoFocus:o,onClick:o?n:function(){},name:"promo-button",style:{color:null==m?void 0:m.textColor,backgroundColor:null==m?void 0:m.color},children:[(null==m?void 0:m.ctaIcon)&&(null==m?void 0:m.ctaIconMode)===U.CtaIconMode.CTA_ICON_TRANSPARENT&&L.jsx(Be,{src:null==m?void 0:m.ctaIcon,alt:"cta-icon"}),(null==m?void 0:m.label)||"Open"]}),L.jsx(je,{name:"chevronRight"})]})]})})},Ye=P.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),Qe=P.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),$e=P.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),Je=P.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),Ze="h10toh7",et=P.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),tt=P.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),nt=P.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),it=P.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),rt=P.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),at=P.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),st=P.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),ot=P.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),ut=P.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),lt=P.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),ct=P.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),dt=P.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),ht=P.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),pt=P.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),ft=P.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),mt=P.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),gt=function(e){var t=e.time,n=e.adCount,i=e.adPosition,r=Math.floor(t/60),a=t-60*r;return 0===r&&0===a&&n===i?null:L.jsxs(pt,{children:[n>1&&L.jsxs(L.Fragment,{children:[L.jsxs(ft,{children:[i," of ",n]}),L.jsx(mt,{})]}),L.jsxs(ft,{children:[r,":",a<10?"0".concat(a):a]})]})},vt=P.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),yt=function(e){var t=e.whyThisAd,n=S(O.useState(!1),2),i=n[0],r=n[1];return t.iconClickThroughURLTemplate&&t.staticResource?L.jsxs(vt,{style:I(I({width:t.width,height:t.height},t.xPosition,3),t.yPosition,11),href:t.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!i&&L.jsx("img",{alt:"ad choice",src:t.staticResource,onLoad:function(){return r(!1)},onError:function(){return r(!0)}}),i&&L.jsx("span",{children:"ad choice"})]}):null},_t=P.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),bt=P.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),Tt=P.styled_default(bt)({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),kt=P.styled_default(bt)({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),St=P.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),wt=P.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),Et="m12n261r",Ct="m16vcml8",At="m1078nk6";function It(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adId:e.adId||null,sequence:e.sequence||null,apiFramework:e.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}var xt=["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 Lt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=[],r=Rt(e);for(var a in!t.ERRORCODE||n.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=Bt(Math.round(1e8*Math.random())),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING,t)t[a]=Mt(t[a]);for(var s in r){var o=r[s];"string"==typeof o&&i.push(Dt(o,t))}return i}function Dt(e,t){var n=(e=Pt(e,t)).match(/[^[\]]+(?=])/g);if(!n)return e;var i=n.filter(function(e){return xt.indexOf(e)>-1});return 0===i.length?e:Pt(e,i=i.reduce(function(e,t){return e[t]=-1,e},{}))}function Pt(e,t){var n=e;for(var i in t){var r=t[i];n=n.replace(new RegExp("(?:\\[|%%)(".concat(i,")(?:\\]|%%)"),"g"),r)}return n}function Rt(e){return Array.isArray(e)?e.map(function(e){return e&&e.hasOwnProperty("url")?e.url:e}):e}function Ot(e){return/^(https?:\/\/|\/\/)/.test(e)}function Nt(e,t){for(var n=0;n<t.length;n++)if(Ut(t[n],e))return!0;return!1}function Ut(e,t){if(e&&t){var n=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);return n.length===i.length&&e.id===t.id&&e.url===t.url}return!1}function Mt(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%".concat(e.charCodeAt(0).toString(16))})}function Bt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.toString().padStart(t,"0")}var jt={track:function(e,t,n){Lt(e,t,n).forEach(function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:Lt,extractURLsFromTemplates:Rt,filterUrlTemplates:function(e){return e.reduce(function(e,t){var n=t.url||t;return Ot(n)?e.validUrls.push(n):e.invalidUrls.push(n),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:Nt,isTemplateObjectEqual:Ut,encodeURIComponentRFC3986:Mt,replaceUrlMacros:Dt,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce(function(t,n){return t.concat(Array.isArray(n)?e(n):n)},[])},joinArrayOfUniqueTemplateObjs:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];return n.concat(i).reduce(function(e,t){return Nt(t,e)||e.push(t),e},[])},isValidTimeValue:function(e){return Number.isFinite(e)&&e>=-2},addLeadingZeros:Bt,isValidUrl:Ot,isBrowserEnvironment:function(){return"undefined"!=typeof window},formatMacrosValues:function(e){return"object"!=k(e)?e:JSON.stringify(e)}};function Ft(e){return["true","TRUE","True","1"].includes(e)}var qt={childByName:function(e,t){return Array.from(e.childNodes).find(function(e){return e.nodeName===t})},childrenByName:function(e,t){return Array.from(e.childNodes).filter(function(e){return e.nodeName===t})},resolveVastAdTagURI:function(e,t){if(!t)return e;if(e.startsWith("//")){var n=location.protocol;return"".concat(n).concat(e)}if(!e.includes("://")){var i=t.slice(0,t.lastIndexOf("/"));return"".concat(i,"/").concat(e)}return e},parseBoolean:Ft,parseNodeText:function(e){return e&&(e.textContent||e.text||"").trim()},copyNodeAttribute:function(e,t,n){var i=t.getAttribute(e);i&&n.setAttribute(e,i)},parseAttributes:function(e){return Array.from(e.attributes).reduce(function(e,t){return e[t.nodeName]=t.nodeValue,e},{})},parseDuration:function(e){if(null==e)return-1;if(jt.isNumeric(e))return parseInt(e);var t=e.split(":");if(3!==t.length)return-1;var n=t[2].split("."),i=parseInt(n[0]);2===n.length&&(i+=parseFloat("0.".concat(n[1])));var r=parseInt(60*t[1]),a=parseInt(60*t[0]*60);return isNaN(a)||isNaN(r)||isNaN(i)||r>3600||i>60?-1:a+r+i},getStandAloneAds:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(function(e){return!parseInt(e.sequence,10)})},getSortedAdPods:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(function(e){return parseInt(e.sequence,10)}).sort(function(e,t){return e.sequence-t.sequence})},assignAttributes:function(e,t){e&&Array.from(e).forEach(function(e){var n=e.nodeName,i=e.nodeValue;if(n&&i&&t.hasOwnProperty(n)){var r=i;"boolean"==typeof t[n]&&(r=Ft(r)),t[n]=r}})},mergeWrapperAdData:function(e,t){var n;e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),t.viewableImpression.length>0&&(e.viewableImpression=[].concat(b(e.viewableImpression),b(t.viewableImpression))),e.followAdditionalWrappers=t.followAdditionalWrappers,e.allowMultipleAds=t.allowMultipleAds,e.fallbackOnNoAd=t.fallbackOnNoAd;var i=(t.creatives||[]).filter(function(e){return e&&"companion"===e.type}),r=i.reduce(function(e,t){return(t.variations||[]).forEach(function(t){(t.companionClickTrackingURLTemplates||[]).forEach(function(t){jt.containsTemplateObject(t,e)||e.push(t)})}),e},[]);e.creatives=i.concat(e.creatives);var a=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,s=t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length;if(e.creatives.forEach(function(e){if(t.trackingEvents&&t.trackingEvents[e.type])for(var n in t.trackingEvents[e.type]){var i=t.trackingEvents[e.type][n];Array.isArray(e.trackingEvents[n])||(e.trackingEvents[n]=[]),e.trackingEvents[n]=e.trackingEvents[n].concat(i)}"linear"===e.type&&(a&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),s&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates)),!t.videoClickThroughURLTemplate||null!==e.videoClickThroughURLTemplate&&void 0!==e.videoClickThroughURLTemplate||(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)),"companion"===e.type&&r.length&&(e.variations||[]).forEach(function(e){e.companionClickTrackingURLTemplates=jt.joinArrayOfUniqueTemplateObjs(e.companionClickTrackingURLTemplates,r)})}),t.adVerifications&&(e.adVerifications=e.adVerifications.concat(t.adVerifications)),t.blockedAdCategories&&(e.blockedAdCategories=e.blockedAdCategories.concat(t.blockedAdCategories)),null!==(n=t.creatives)&&void 0!==n&&n.length){var o=t.creatives.filter(function(e){var t;return(null===(t=e.icons)||void 0===t?void 0:t.length)&&!e.mediaFiles.length});o.length&&(e.creatives=e.creatives.concat(o))}}};function Vt(e,t){var n=function(){var e=It(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"companion",required:null,variations:[]}}(t);return n.required=e.getAttribute("required")||null,n.variations=qt.childrenByName(e,"Companion").map(function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adType:"companionAd",width:e.width||0,height:e.height||0,assetWidth:e.assetWidth||null,assetHeight:e.assetHeight||null,expandedWidth:e.expandedWidth||null,expandedHeight:e.expandedHeight||null,apiFramework:e.apiFramework||null,adSlotId:e.adSlotId||null,pxratio:e.pxratio||"1",renderingMode:e.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(qt.parseAttributes(e));t.htmlResources=qt.childrenByName(e,"HTMLResource").reduce(function(e,t){var n=qt.parseNodeText(t);return n?e.concat(n):e},[]),t.iframeResources=qt.childrenByName(e,"IFrameResource").reduce(function(e,t){var n=qt.parseNodeText(t);return n?e.concat(n):e},[]),t.staticResources=qt.childrenByName(e,"StaticResource").reduce(function(e,t){var n=qt.parseNodeText(t);return n?e.concat({url:n,creativeType:t.getAttribute("creativeType")||null}):e},[]),t.altText=qt.parseNodeText(qt.childByName(e,"AltText"))||null;var n=qt.childByName(e,"TrackingEvents");n&&qt.childrenByName(n,"Tracking").forEach(function(e){var n=e.getAttribute("event"),i=qt.parseNodeText(e);n&&i&&(Array.isArray(t.trackingEvents[n])||(t.trackingEvents[n]=[]),t.trackingEvents[n].push(i))}),t.companionClickTrackingURLTemplates=qt.childrenByName(e,"CompanionClickTracking").map(function(e){return{id:e.getAttribute("id")||null,url:qt.parseNodeText(e)}}),t.companionClickThroughURLTemplate=qt.parseNodeText(qt.childByName(e,"CompanionClickThrough"))||null;var i=qt.childByName(e,"AdParameters");return i&&(t.adParameters={value:qt.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t}),n}function Ht(e,t){var n,i=function(){var e=It(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(t);i.duration=qt.parseDuration(qt.parseNodeText(qt.childByName(e,"Duration")));var r=e.getAttribute("skipoffset");if(null==r)i.skipDelay=null;else if("%"===r.charAt(r.length-1)&&-1!==i.duration){var a=parseInt(r,10);i.skipDelay=i.duration*(a/100)}else i.skipDelay=qt.parseDuration(r);var s=qt.childByName(e,"VideoClicks");if(s){var o=qt.childByName(s,"ClickThrough");i.videoClickThroughURLTemplate=o?{id:o.getAttribute("id")||null,url:qt.parseNodeText(o)}:null,qt.childrenByName(s,"ClickTracking").forEach(function(e){i.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:qt.parseNodeText(e)})}),qt.childrenByName(s,"CustomClick").forEach(function(e){i.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:qt.parseNodeText(e)})})}var u=qt.childByName(e,"AdParameters");u&&(i.adParameters={value:qt.parseNodeText(u),xmlEncoded:u.getAttribute("xmlEncoded")||null}),qt.childrenByName(e,"TrackingEvents").forEach(function(e){qt.childrenByName(e,"Tracking").forEach(function(e){var t=e.getAttribute("event"),r=qt.parseNodeText(e);if(t&&r){if("progress"===t){if(!(n=e.getAttribute("offset")))return;t="%"===n.charAt(n.length-1)?"progress-".concat(n):"progress-".concat(qt.parseDuration(n))}Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(r)}})}),qt.childrenByName(e,"MediaFiles").forEach(function(e){qt.childrenByName(e,"MediaFile").forEach(function(e){i.mediaFiles.push(function(e){var t={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};t.id=e.getAttribute("id"),t.fileURL=qt.parseNodeText(e),t.deliveryType=e.getAttribute("delivery"),t.codec=e.getAttribute("codec"),t.mimeType=e.getAttribute("type"),t.mediaType=e.getAttribute("mediaType")||"2D",t.apiFramework=e.getAttribute("apiFramework"),t.fileSize=parseInt(e.getAttribute("fileSize")||0),t.bitrate=parseInt(e.getAttribute("bitrate")||0),t.minBitrate=parseInt(e.getAttribute("minBitrate")||0),t.maxBitrate=parseInt(e.getAttribute("maxBitrate")||0),t.width=parseInt(e.getAttribute("width")||0),t.height=parseInt(e.getAttribute("height")||0);var n=e.getAttribute("scalable");n&&"string"==typeof n&&(t.scalable=qt.parseBoolean(n));var i=e.getAttribute("maintainAspectRatio");return i&&"string"==typeof i&&(t.maintainAspectRatio=qt.parseBoolean(i)),t}(e))});var t,n,r=qt.childByName(e,"InteractiveCreativeFile");r&&(i.interactiveCreativeFile=(t=r,n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,apiFramework:e.apiFramework||null,variableDuration:qt.parseBoolean(e.variableDuration),fileURL:null}}(qt.parseAttributes(t)),n.fileURL=qt.parseNodeText(t),n));var a=qt.childByName(e,"ClosedCaptionFiles");a&&qt.childrenByName(a,"ClosedCaptionFile").forEach(function(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,language:e.language||null,fileURL:null}}(qt.parseAttributes(e));t.fileURL=qt.parseNodeText(e),i.closedCaptionFiles.push(t)});var s=qt.childByName(e,"Mezzanine"),o=function(e){var t={},n=!1;return["delivery","type","width","height"].forEach(function(i){e&&e.getAttribute(i)?t[i]=e.getAttribute(i):n=!0}),n?null:t}(s);if(o){var u={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};u.id=s.getAttribute("id"),u.fileURL=qt.parseNodeText(s),u.delivery=o.delivery,u.codec=s.getAttribute("codec"),u.type=o.type,u.width=parseInt(o.width,10),u.height=parseInt(o.height,10),u.fileSize=parseInt(s.getAttribute("fileSize"),10),u.mediaType=s.getAttribute("mediaType")||"2D",i.mezzanine=u}});var l=qt.childByName(e,"Icons");return l&&qt.childrenByName(l,"Icon").forEach(function(e){i.icons.push(function(e){var t,n={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};n.program=e.getAttribute("program"),n.height=parseInt(e.getAttribute("height")||0),n.width=parseInt(e.getAttribute("width")||0),n.xPosition=(t=e.getAttribute("xPosition"),-1!==["left","right"].indexOf(t)?t:parseInt(t||0)),n.yPosition=function(e){return-1!==["top","bottom"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("yPosition")),n.apiFramework=e.getAttribute("apiFramework"),n.pxratio=e.getAttribute("pxratio")||"1",n.offset=qt.parseDuration(e.getAttribute("offset")),n.duration=qt.parseDuration(e.getAttribute("duration")),n.altText=e.getAttribute("altText"),n.hoverText=e.getAttribute("hoverText"),qt.childrenByName(e,"HTMLResource").forEach(function(e){n.type=e.getAttribute("creativeType")||"text/html",n.htmlResource=qt.parseNodeText(e)}),qt.childrenByName(e,"IFrameResource").forEach(function(e){n.type=e.getAttribute("creativeType")||0,n.iframeResource=qt.parseNodeText(e)}),qt.childrenByName(e,"StaticResource").forEach(function(e){n.type=e.getAttribute("creativeType")||0,n.staticResource=qt.parseNodeText(e)});var i=qt.childByName(e,"IconClicks");if(i){n.iconClickThroughURLTemplate=qt.parseNodeText(qt.childByName(i,"IconClickThrough")),qt.childrenByName(i,"IconClickTracking").forEach(function(e){n.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:qt.parseNodeText(e)})});var r=qt.childByName(i,"IconClickFallbackImages");r&&qt.childrenByName(r,"IconClickFallbackImage").forEach(function(e){n.iconClickFallbackImages.push({url:qt.parseNodeText(e)||null,width:e.getAttribute("width")||null,height:e.getAttribute("height")||null})})}return n.iconViewTrackingURLTemplate=qt.parseNodeText(qt.childByName(e,"IconViewTracking")),n}(e))}),i}function zt(e,t){var n=function(){var e=It(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{});return{id:e.id,adId:e.adId,sequence:e.sequence,apiFramework:e.apiFramework,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return qt.childrenByName(e,"TrackingEvents").forEach(function(e){var t,i;qt.childrenByName(e,"Tracking").forEach(function(e){t=e.getAttribute("event"),i=qt.parseNodeText(e),t&&i&&(Array.isArray(n.trackingEvents[t])||(n.trackingEvents[t]=[]),n.trackingEvents[t].push(i))})}),qt.childrenByName(e,"NonLinear").forEach(function(e){var t={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};t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.expandedWidth=e.getAttribute("expandedWidth"),t.expandedHeight=e.getAttribute("expandedHeight"),t.scalable=qt.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=qt.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=qt.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),qt.childrenByName(e,"HTMLResource").forEach(function(e){t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=qt.parseNodeText(e)}),qt.childrenByName(e,"IFrameResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.iframeResource=qt.parseNodeText(e)}),qt.childrenByName(e,"StaticResource").forEach(function(e){t.type=e.getAttribute("creativeType")||0,t.staticResource=qt.parseNodeText(e)});var i=qt.childByName(e,"AdParameters");i&&(t.adParameters={value:qt.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t.nonlinearClickThroughURLTemplate=qt.parseNodeText(qt.childByName(e,"NonLinearClickThrough")),qt.childrenByName(e,"NonLinearClickTracking").forEach(function(e){t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:qt.parseNodeText(e)})}),n.variations.push(t)}),n}function Wt(e){var t=[];return e.forEach(function(e){var n=Gt(e);n&&t.push(n)}),t}function Gt(e){if("#comment"===e.nodeName)return null;var t,n={name:null,value:null,attributes:{},children:[]},i=e.attributes,r=e.childNodes;if(n.name=e.nodeName,e.attributes)for(var a in i)if(i.hasOwnProperty(a)){var s=i[a];s.nodeName&&s.nodeValue&&(n.attributes[s.nodeName]=s.nodeValue)}for(var o in r)if(r.hasOwnProperty(o)){var u=Gt(r[o]);u&&n.children.push(u)}if(0===n.children.length||1===n.children.length&&["#cdata-section","#text"].indexOf(n.children[0].name)>=0){var l=qt.parseNodeText(e);""!==l&&(n.value=l),n.children=[]}return null===(t=n).value&&0===Object.keys(t.attributes).length&&0===t.children.length?null:n}function Xt(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}var Kt={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 Yt(e,t){if(Kt[e.nodeName]&&Kt[e.nodeName].attributes){var n=Kt[e.nodeName].attributes.filter(function(t){return!e.getAttribute(t)});n.length>0&&Jt({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:n},t)}}function Qt(e,t,n){var i=Kt[e.nodeName],r=!n&&"Wrapper"!==e.nodeName;if(i&&!r){if(i.subElements){var a=i.subElements.filter(function(t){return!qt.childByName(e,t)});a.length>0&&Jt({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:a},t)}n&&i.oneOfinLineResources&&(i.oneOfinLineResources.some(function(t){return qt.childByName(e,t)})||Jt({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},t))}}function $t(e){return e.children&&0!==e.children.length}function Jt(e,t){var n=e.name,i=e.parentName,r=e.attributes,a=e.subElements,s=e.oneOfResources,o="Element '".concat(n,"'");t("VAST-warning",{message:o+=r?" missing required attribute(s) '".concat(r.join(", "),"' "):a?" missing required sub element(s) '".concat(a.join(", "),"' "):s?" must provide one of the following '".concat(s.join(", "),"' "):" is empty",parentElement:i,specVersion:4.1})}var Zt=function e(t,n,i){if(t&&t.nodeName)if("InLine"===t.nodeName&&(i=!0),Yt(t,n),$t(t)){Qt(t,n,i);for(var r=0;r<t.children.length;r++)e(t.children[r],n,i)}else 0===qt.parseNodeText(t).length&&Jt({name:t.nodeName,parentName:t.parentNode.nodeName},n)};function en(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=i.allowMultipleAds,a=i.followAdditionalWrappers,s=_(Array.from(e.childNodes).filter(function(e){var t=e.nodeName.toLowerCase();return"inline"===t||!1!==a&&"wrapper"===t}));try{for(s.s();!(n=s.n()).done;){var o=n.value;if(qt.copyNodeAttribute("id",e,o),qt.copyNodeAttribute("sequence",e,o),qt.copyNodeAttribute("adType",e,o),"Wrapper"===o.nodeName)return{ad:rn(o,t),type:"WRAPPER"};if("InLine"===o.nodeName)return{ad:tn(o,t,{allowMultipleAds:r}),type:"INLINE"};var u=o.nodeName.toLowerCase();t("VAST-warning",{message:"<".concat(o.nodeName,"inline"===u?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:o})}}catch(l){s.e(l)}finally{s.f()}}function tn(e,t){return!1===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allowMultipleAds&&e.getAttribute("sequence")?null:nn(e,t)}function nn(e,t){var n=[];t&&Zt(e,t);var i=Array.from(e.childNodes),r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,sequence:e.sequence||null,adType:e.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}}(qt.parseAttributes(e));return i.forEach(function(e){switch(e.nodeName){case"Error":r.errorURLTemplates.push(qt.parseNodeText(e));break;case"Impression":r.impressionURLTemplates.push({id:e.getAttribute("id")||null,url:qt.parseNodeText(e)});break;case"Creatives":r.creatives=(i=qt.childrenByName(e,"Creative"),a=[],i.forEach(function(e){var t,n={id:e.getAttribute("id")||null,adId:Xt(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},i=[];qt.childrenByName(e,"UniversalAdId").forEach(function(e){var t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:qt.parseNodeText(e)};i.push(t)});var r=qt.childByName(e,"CreativeExtensions");for(var s in r&&(t=Wt(qt.childrenByName(r,"CreativeExtension"))),e.childNodes){var o=e.childNodes[s],u=void 0;switch(o.nodeName){case"Linear":u=Ht(o,n);break;case"NonLinearAds":u=zt(o,n);break;case"CompanionAds":u=Vt(o,n)}u&&(i&&(u.universalAdIds=i),t&&(u.creativeExtensions=t),a.push(u))}}),a);break;case"Extensions":var t=qt.childrenByName(e,"Extension");r.extensions=Wt(t),r.adVerifications.length||(n=function(e){var t=null,n=[];return e.some(function(e){return t=qt.childByName(e,"AdVerifications")}),t&&(n=an(qt.childrenByName(t,"Verification"))),n}(t));break;case"AdVerifications":r.adVerifications=an(qt.childrenByName(e,"Verification"));break;case"AdSystem":r.system={value:qt.parseNodeText(e),version:e.getAttribute("version")||null};break;case"AdTitle":r.title=qt.parseNodeText(e);break;case"AdServingId":r.adServingId=qt.parseNodeText(e);break;case"Category":r.categories.push({authority:e.getAttribute("authority")||null,value:qt.parseNodeText(e)});break;case"Expires":r.expires=parseInt(qt.parseNodeText(e),10);break;case"ViewableImpression":r.viewableImpression.push(function(e){var t=function(e,t){var n=qt.parseNodeText(t);return n&&e.push(n),e};return{id:e.getAttribute("id")||null,viewable:qt.childrenByName(e,"Viewable").reduce(t,[]),notViewable:qt.childrenByName(e,"NotViewable").reduce(t,[]),viewUndetermined:qt.childrenByName(e,"ViewUndetermined").reduce(t,[])}}(e));break;case"Description":r.description=qt.parseNodeText(e);break;case"Advertiser":r.advertiser={id:e.getAttribute("id")||null,value:qt.parseNodeText(e)};break;case"Pricing":r.pricing={value:qt.parseNodeText(e),model:e.getAttribute("model")||null,currency:e.getAttribute("currency")||null};break;case"Survey":r.survey={value:qt.parseNodeText(e),type:e.getAttribute("type")||null};break;case"BlockedAdCategories":r.blockedAdCategories.push({authority:e.getAttribute("authority")||null,value:qt.parseNodeText(e)})}var i,a}),n.length&&(r.adVerifications=r.adVerifications.concat(n)),r}function rn(e,t){var n=nn(e,t),i=e.getAttribute("followAdditionalWrappers"),r=e.getAttribute("allowMultipleAds"),a=e.getAttribute("fallbackOnNoAd");n.followAdditionalWrappers=!i||qt.parseBoolean(i),n.allowMultipleAds=!!r&&qt.parseBoolean(r),n.fallbackOnNoAd=a?qt.parseBoolean(a):null;var s=qt.childByName(e,"VASTAdTagURI");if(s?n.nextWrapperURL=qt.parseNodeText(s):(s=qt.childByName(e,"VASTAdTagURL"))&&(n.nextWrapperURL=qt.parseNodeText(qt.childByName(s,"URL"))),n.creatives.forEach(function(e){if(["linear","nonlinear"].includes(e.type)){if(e.trackingEvents){n.trackingEvents||(n.trackingEvents={}),n.trackingEvents[e.type]||(n.trackingEvents[e.type]={});var t=function(t){var i=e.trackingEvents[t];Array.isArray(n.trackingEvents[e.type][t])||(n.trackingEvents[e.type][t]=[]),i.forEach(function(i){n.trackingEvents[e.type][t].push(i)})};for(var i in e.trackingEvents)t(i)}e.videoClickTrackingURLTemplates&&(Array.isArray(n.videoClickTrackingURLTemplates)||(n.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach(function(e){n.videoClickTrackingURLTemplates.push(e)})),e.videoClickThroughURLTemplate&&(n.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(Array.isArray(n.videoCustomClickURLTemplates)||(n.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach(function(e){n.videoCustomClickURLTemplates.push(e)}))}}),n.nextWrapperURL)return n}function an(e){var t=[];return e.forEach(function(e){var n={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},i=Array.from(e.childNodes);qt.assignAttributes(e.attributes,n),i.forEach(function(e){var t=e.nodeName,i=e.textContent,r=e.attributes;switch(t){case"JavaScriptResource":case"ExecutableResource":n.resource=i.trim(),qt.assignAttributes(r,n);break;case"VerificationParameters":n.parameters=i.trim()}});var r=qt.childByName(e,"TrackingEvents");r&&qt.childrenByName(r,"Tracking").forEach(function(e){var t=e.getAttribute("event"),i=qt.parseNodeText(e);t&&i&&(Array.isArray(n.trackingEvents[t])||(n.trackingEvents[t]=[]),n.trackingEvents[t].push(i))}),t.push(n)}),t}var sn,on,un=function(){return y(function e(){g(this,e),this._handlers=[]},[{key:"on",value:function(e,t){if("function"!=typeof t)throw new TypeError("The handler argument must be of type Function. Received type ".concat(k(t)));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(k(e)));return this._handlers.push({event:e,handler:t}),this}},{key:"once",value:function(e,t){return this.on(e,function(e,t,n){var i={fired:!1,wrapFn:void 0};function r(){i.fired||(e.off(t,i.wrapFn),i.fired=!0,n.bind(e).apply(void 0,arguments))}return i.wrapFn=r,r}(this,e,t))}},{key:"off",value:function(e,t){return this._handlers=this._handlers.filter(function(n){return n.event!==e||n.handler!==t}),this}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var r=!1;return this._handlers.forEach(function(t){"*"===t.event&&(r=!0,t.handler.apply(t,[e].concat(n))),t.event===e&&(r=!0,t.handler.apply(t,n))}),r}},{key:"removeAllListeners",value:function(e){return e?(this._handlers=this._handlers.filter(function(t){return t.event!==e}),this):(this._handlers=[],this)}},{key:"listenerCount",value:function(e){return this._handlers.filter(function(t){return t.event===e}).length}},{key:"listeners",value:function(e){return this._handlers.reduce(function(t,n){return n.event===e&&t.push(n.handler),t},[])}},{key:"eventNames",value:function(){return this._handlers.map(function(e){return e.event})}}])}(),ln=0,cn=0,dn=function(e,t){!e||!t||e<=0||t<=0||(cn=(cn*ln+8*e/t)/++ln)},hn={ERRORCODE:900,extensions:[]},pn="VAST response version not supported",fn=function(){function e(){var t;g(this,e);var n=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).fetcher;return(t=c(this,e)).maxWrapperDepth=null,t.rootErrorURLTemplates=[],t.errorURLTemplates=[],t.remainingAds=[],t.parsingOptions={},t.fetcher=n||null,t.keepFailedAdPod=!1,t}return f(e,un),y(e,[{key:"trackVastError",value:function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];this.emit("VAST-error",Object.assign.apply(Object,[{},hn,t].concat(i))),jt.track(e,t)}},{key:"getErrorURLTemplates",value:function(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}},{key:"getEstimatedBitrate",value:function(){return cn}},{key:"initParsingStatus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.keepFailedAdPod=e.keepFailedAdPod||!1,this.rootURL="",this.resetParsingStatus(),dn(e.byteLength,e.requestDuration)}},{key:"resetParsingStatus",value:function(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}},{key:"getRemainingAds",value:function(e){var t=this;if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));var n=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(n,{wrapperDepth:0,url:this.rootURL}).then(function(e){return t.buildVASTResponse(e)})}},{key:"parseVAST",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(n),n.isRootVAST=!0,this.parse(e,n).then(function(e){return t.buildVASTResponse(e)})}},{key:"buildVASTResponse",value:function(e){var t,n={ads:(t={ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion}).ads||[],errorURLTemplates:t.errorURLTemplates||[],version:t.version||null};return this.completeWrapperResolving(n),n}},{key:"parseVastXml",value:function(e,t){var n=t.isRootVAST,i=void 0!==n&&n,r=t.url,a=void 0===r?null:r,s=t.wrapperDepth,o=void 0===s?0:s,u=t.allowMultipleAds,l=t.followAdditionalWrappers;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName){var c;this.emit("VAST-ad-parsed",{type:"ERROR",url:a,wrapperDepth:o});var d="VideoAdServingTemplate"===(null==e||null===(c=e.documentElement)||void 0===c?void 0:c.nodeName);throw new Error(d?pn:"Invalid VAST XMLDocument")}var h=[],p=e.documentElement.childNodes,f=e.documentElement.getAttribute("version");for(var m in i&&f&&(this.vastVersion=f),p){var g=p[m];if("Error"===g.nodeName){var v=qt.parseNodeText(g);i?this.rootErrorURLTemplates.push(v):this.errorURLTemplates.push(v)}else if("Ad"===g.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)u=!0;else if(!1===u&&h.length>1)break;var y=en(g,this.emit.bind(this),{allowMultipleAds:u,followAdditionalWrappers:l});y.ad?(h.push(y.ad),this.emit("VAST-ad-parsed",{type:y.type,url:a,wrapperDepth:o,adIndex:h.length-1,vastVersion:f})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return h}},{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.url,i=void 0===n?null:n,r=t.resolveAll,a=void 0===r||r,s=t.wrapperSequence,o=void 0===s?null:s,u=t.previousUrl,l=void 0===u?null:u,c=t.wrapperDepth,d=void 0===c?0:c,h=t.isRootVAST,p=void 0!==h&&h,f=t.followAdditionalWrappers,m=t.allowMultipleAds,g=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&p&&(m=!0);try{g=this.parseVastXml(e,{isRootVAST:p,url:i,wrapperDepth:d,allowMultipleAds:m,followAdditionalWrappers:f})}catch(_){return Promise.reject(_)}if(1===g.length&&null!=o&&(g[0].sequence=o),!1===a){var v=qt.getSortedAdPods(g),y=qt.getStandAloneAds(g);v.length?g=v:y.length&&(g=[y.shift()]),this.remainingAds=y}return this.resolveAds(g,{wrapperDepth:d,previousUrl:l,url:i})}},{key:"resolveAds",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,i=n.wrapperDepth,r=n.previousUrl,a=n.url,s=[];return r=a,t.forEach(function(t){var n=e.resolveWrappers(t,i,r);s.push(n)}),Promise.all(s).then(function(e){return jt.flatten(e)})}},{key:"resolveWrappers",value:function(e,t,n){var i=this,r=l({},e);return new Promise(function(e){var a;if(t++,!r.nextWrapperURL)return delete r.nextWrapperURL,e(r);if(!i.fetcher)return r.VASTAdTagURI=r.nextWrapperURL,delete r.nextWrapperURL,e(r);if(t>=i.maxWrapperDepth)return r.errorCode=302,delete r.nextWrapperURL,e(r);r.nextWrapperURL=qt.resolveVastAdTagURI(r.nextWrapperURL,n);var s=null!==(a=i.parsingOptions.allowMultipleAds)&&void 0!==a?a:r.allowMultipleAds,o=r.sequence;i.fetcher.fetchVAST({url:r.nextWrapperURL,emitter:i.emit.bind(i),maxWrapperDepth:i.maxWrapperDepth}).then(function(a){return i.parse(a,{url:r.nextWrapperURL,previousUrl:n,wrapperSequence:o,wrapperDepth:t,followAdditionalWrappers:r.followAdditionalWrappers,allowMultipleAds:s}).then(function(t){if(delete r.nextWrapperURL,0===t.length)return r.creatives=[],e(r);t.forEach(function(e){e&&qt.mergeWrapperAdData(e,r)}),e(t)})}).catch(function(t){r.errorCode=t.message===pn?102:301,r.errorMessage=t.message,e(r)})})}},{key:"completeWrapperResolving",value:function(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(var t=e.ads.length-1;t>=0;t--){var n=e.ads[t],i=!n.creatives.some(function(e){var t,n;return(null===(t=e.mediaFiles)||void 0===t?void 0:t.length)>0||(null===(n=e.variations)||void 0===n?void 0:n.length)>0});!n.errorCode&&!i||n.VASTAdTagURI||(this.trackVastError(n.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:n.errorCode||303},{ERRORMESSAGE:n.errorMessage||""},{extensions:n.extensions},{system:n.system}),this.keepFailedAdPod&&n.sequence?n.hasFailed=!0:e.ads.splice(t,1))}}}])}(),mn=null,gn={data:{},length:0,getItem:function(e){return this.data[e]},setItem:function(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem:function(e){delete this.data[e],this.length=Object.keys(this.data).length},clear:function(){this.data={},this.length=0}},vn=function(){return y(function e(){g(this,e),this.storage=this.initStorage()},[{key:"initStorage",value:function(){if(mn)return mn;try{mn="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){mn=null}return mn&&!this.isStorageDisabled(mn)||(mn=gn).clear(),mn}},{key:"isStorageDisabled",value:function(e){var t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch(n){return!0}return e.removeItem(t),!1}},{key:"getItem",value:function(e){return this.storage.getItem(e)}},{key:"setItem",value:function(e,t){return this.storage.setItem(e,t)}},{key:"removeItem",value:function(e){return this.storage.removeItem(e)}},{key:"clear",value:function(){return this.storage.clear()}}])}(),yn=12e4,_n={get:(sn=o(r().m(function e(t,n){var i,a,s,u,c;return r().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,i=new AbortController,a=setTimeout(function(){throw i.abort(),new Error("URLHandler: Request timed out after ".concat(n.timeout||yn," ms (408)"))},n.timeout||yn),e.n=1,fetch(t,l(l({},n),{},{signal:i.signal,credentials:n.withCredentials?"include":"omit"})).finally(function(){clearTimeout(a)});case 1:return s=e.v,u=function(e){return jt.isBrowserEnvironment()&&"https:"===window.location.protocol&&e.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":200===e.status&&e.ok?null:"URLHandler: ".concat(e.statusText," (").concat(e.status,")")}(s),e.a(2,u?{error:new Error(u),statusCode:s.status}:function(){var e=o(r().m(function e(t){var n,i,a,s;return r().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.text();case 1:if(n=e.v,!jt.isBrowserEnvironment()){e.n=2;break}a=new DOMParser,e.n=4;break;case 2:return e.n=3,Promise.resolve().then(function(){return Bs});case 3:s=e.v.DOMParser,a=new s;case 4:return i=a,e.a(2,{xml:i.parseFromString(n,"text/xml"),details:{byteLength:n.length,statusCode:t.status,rawXml:n}})}},e)}));return function(t){return e.apply(this,arguments)}}()(s));case 2:return e.p=2,c=e.v,e.a(2,{error:c,statusCode:"AbortError"===c.name?408:null})}},e,null,[[0,2]])})),function(e,t){return sn.apply(this,arguments)})},bn=function(){return y(function e(){g(this,e),this.URLTemplateFilters=[]},[{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||_n,this.fetchingOptions=l(l({},e.fetchOptions),{},{timeout:e.timeout||yn,withCredentials:Boolean(e.withCredentials)})}},{key:"addURLTemplateFilter",value:function(e){"function"==typeof e&&this.URLTemplateFilters.push(e)}},{key:"removeLastURLTemplateFilter",value:function(){this.URLTemplateFilters.pop()}},{key:"countURLTemplateFilters",value:function(){return this.URLTemplateFilters.length}},{key:"clearURLTemplateFilters",value:function(){this.URLTemplateFilters=[]}},{key:"fetchVAST",value:(e=o(r().m(function e(t){var n,i,a,s,o,u,c,d,h,p,f,m,g;return r().w(function(e){for(;;)switch(e.n){case 0:return i=t.url,a=t.maxWrapperDepth,s=t.emitter,o=t.wrapperDepth,u=void 0===o?0:o,c=t.previousUrl,d=void 0===c?null:c,h=t.wrapperAd,p=void 0===h?null:h,f=Date.now(),this.URLTemplateFilters.forEach(function(e){i=e(i)}),s("VAST-resolving",{url:i,previousUrl:d,wrapperDepth:u,maxWrapperDepth:a,timeout:this.fetchingOptions.timeout,wrapperAd:p}),e.n=1,this.urlHandler.get(i,this.fetchingOptions);case 1:if(m=e.v,g=Math.round(Date.now()-f),s("VAST-resolved",l({url:i,previousUrl:d,wrapperDepth:u,error:(null==m?void 0:m.error)||null,duration:g,statusCode:(null==m?void 0:m.statusCode)||null},null==m?void 0:m.details)),dn(null==m||null===(n=m.details)||void 0===n?void 0:n.byteLength,g),!m.error){e.n=2;break}throw new Error(m.error);case 2:return e.a(2,m.xml)}},e,this)})),function(t){return e.apply(this,arguments)})}]);var e}(),Tn=function(){return y(function e(){g(this,e);var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new vn;this.cappingFreeLunch=t,this.cappingMinimumTimeInterval=n,this.fetcher=new bn,this.vastParser=new fn({fetcher:this.fetcher}),this.storage=i,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)},[{key:"addURLTemplateFilter",value:function(e){this.fetcher.addURLTemplateFilter(e)}},{key:"removeLastURLTemplateFilter",value:function(){this.fetcher.removeLastURLTemplateFilter()}},{key:"countURLTemplateFilters",value:function(){return this.fetcher.countURLTemplateFilters()}},{key:"clearURLTemplateFilters",value:function(){this.fetcher.clearURLTemplateFilters()}},{key:"getParser",value:function(){return this.vastParser}},{key:"lastSuccessfulAd",get:function(){return this.storage.getItem("vast-client-last-successful-ad")},set:function(e){this.storage.setItem("vast-client-last-successful-ad",e)}},{key:"totalCalls",get:function(){return this.storage.getItem("vast-client-total-calls")},set:function(e){this.storage.setItem("vast-client-total-calls",e)}},{key:"totalCallsTimeout",get:function(){return this.storage.getItem("vast-client-total-calls-timeout")},set:function(e){this.storage.setItem("vast-client-total-calls-timeout",e)}},{key:"hasRemainingAds",value:function(){return this.vastParser.remainingAds.length>0}},{key:"getNextAds",value:function(e){return this.vastParser.getRemainingAds(e)}},{key:"parseVAST",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}},{key:"get",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=Date.now();return n.hasOwnProperty("resolveAll")||(n.resolveAll=!1),this.totalCallsTimeout<i?(this.totalCalls=1,this.totalCallsTimeout=i+36e5):this.totalCalls++,new Promise(function(r,a){if(t.cappingFreeLunch>=t.totalCalls)return a(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(t.totalCalls,"/").concat(t.cappingFreeLunch)));var s=i-t.lastSuccessfulAd;if(s<0)t.lastSuccessfulAd=0;else if(s<t.cappingMinimumTimeInterval)return a(new Error("VAST call canceled – (".concat(t.cappingMinimumTimeInterval,")ms minimum interval reached")));t.vastParser.initParsingStatus(n),t.fetcher.setOptions(n),t.vastParser.rootURL=e,t.fetcher.fetchVAST({url:e,emitter:t.vastParser.emit.bind(t.vastParser),maxWrapperDepth:t.vastParser.maxWrapperDepth}).then(function(i){return n.previousUrl=e,n.isRootVAST=!0,n.url=e,t.vastParser.parse(i,n).then(function(e){var n=t.vastParser.buildVASTResponse(e);r(n)})}).catch(function(e){return a(e)})})}}])}(),kn=function(){function e(t,n,i){var r,a;g(this,e);var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];for(var u in(r=c(this,e)).ad=n,r.creative=i,r.variation=s,r.muted=o,r.impressed=!1,r.skippable=!1,r.trackingEvents={},r.trackedProgressEvents=[],r.lastPercentage=0,r._alreadyTriggeredQuartiles={},r.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"],r.creative.trackingEvents){var l=r.creative.trackingEvents[u];r.trackingEvents[u]=l.slice(0)}return r.viewableImpressionTrackers=(null===(a=r.ad.viewableImpression)||void 0===a?void 0:a.reduce(function(e,t){var n,i,r;return(n=e.notViewable).push.apply(n,b(t.notViewable)),(i=e.viewUndetermined).push.apply(i,b(t.viewUndetermined)),(r=e.viewable).push.apply(r,b(t.viewable)),e},{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(r.viewableImpressionTrackers).forEach(function(e){var t=S(e,2),n=t[0],i=t[1];i.length&&(r.trackingEvents[n]=i)}),"linear"!==r.creative.type?r._initVariationTracking():r._initLinearTracking(),t&&r.on("start",function(){t.lastSuccessfulAd=Date.now()}),r}return f(e,un),y(e,[{key:"_initLinearTracking",value:function(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}},{key:"_initVariationTracking",value:function(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(var e in this.variation.trackingEvents){var t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}"nonLinearAd"===this.variation.adType?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):"companionAd"===this.variation.adType&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}},{key:"setDuration",value:function(e){jt.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)})}},{key:"setProgress",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(jt.isValidTimeValue(e)&&"object"==k(n)){var r=this.skipDelay||-1;if(-1===r||this.skippable||(r>e?this.emit("skip-countdown",r-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){var a=Math.round(e/this.assetDuration*100),s=[];if(e>0){s.push("start");for(var o=this.lastPercentage;o<a;o++)s.push("progress-".concat(o+1,"%"));for(var u in s.push("progress-".concat(e)),this.quartiles)this.isQuartileReached(u,this.quartiles[u],e)&&(s.push(u),this._alreadyTriggeredQuartiles[u]=!0);this.lastPercentage=a}s.forEach(function(e){t.track(e,{macros:n,once:i})}),e<this.progress&&(this.track("rewind",{macros:n}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}else this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(jt.formatMacrosValues(n))})}},{key:"isQuartileReached",value:function(e,t,n){var i=!1;return t<=n&&!this._alreadyTriggeredQuartiles[e]&&(i=!0),i}},{key:"setMuted",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==k(t)?(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(jt.formatMacrosValues(t))})}},{key:"setPaused",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==k(t)?(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(jt.formatMacrosValues(t))})}},{key:"setFullscreen",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==k(t)?(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(jt.formatMacrosValues(t))})}},{key:"setExpand",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==k(t)?(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(jt.formatMacrosValues(t))})}},{key:"setSkipDelay",value:function(e){jt.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}},{key:"trackImpression",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?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)})}},{key:"trackViewableImpression",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==k(e)?this.track("viewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}},{key:"trackNotViewableImpression",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==k(e)?this.track("notViewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}},{key:"trackUndeterminedImpression",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==k(e)?this.track("viewUndetermined",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}},{key:"error",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==k(e)&&"boolean"==typeof t?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(jt.formatMacrosValues(e),", isCustomCode: ").concat(t)})}},{key:"errorWithCode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"string"==typeof e&&"boolean"==typeof t?(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)})}},{key:"complete",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}},{key:"notUsed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}},{key:"otherAdInteraction",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}},{key:"acceptInvitation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}},{key:"adExpand",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}},{key:"adCollapse",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}},{key:"minimize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}},{key:"verificationNotExecuted",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e&&"object"==k(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");var n=this.ad.adVerifications.find(function(t){return t.vendor===e});if(!n)throw new Error("No associated verification element found for vendor: ".concat(e));var i=n.trackingEvents;if(i&&i.verificationNotExecuted){var r=i.verificationNotExecuted;this.trackURLs(r,t),this.emit("verificationNotExecuted",{trackingURLTemplates:r})}}else this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(jt.formatMacrosValues(t))})}},{key:"overlayViewDuration",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&"object"==k(t)?(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(jt.formatMacrosValues(t))})}},{key:"close",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}},{key:"skip",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}},{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==k(e)?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}},{key:"click",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!==e&&"string"!=typeof e||"object"!=k(t))this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(jt.formatMacrosValues(t))});else{this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);var n=this.clickThroughURLTemplate||e,i=l({},t);if(n){this.progress&&(i.ADPLAYHEAD=this.progressFormatted());var r=jt.resolveURLTemplates([n],i)[0];this.emit("clickthrough",r)}}}},{key:"trackProgressEvents",value:function(e,t,n){var i=this,r=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(function(e){return S(e,1)[0].startsWith("progress-")}).map(function(e){var t=S(e,2),n=t[0],i=t[1];return{name:n,time:parseFloat(n.split("-")[1]),urls:i}}).filter(function(e){var t=e.time;return t<=r&&t>i.progress}).forEach(function(e){var r=e.name,a=e.urls;!n&&i.trackedProgressEvents.includes(r)||(i.emit(r,{trackingURLTemplates:a}),i.trackURLs(a,t),n?delete i.trackingEvents[r]:i.trackedProgressEvents.push(r))})}},{key:"track",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.macros,i=void 0===n?{}:n,r=t.once,a=void 0!==r&&r;if("object"==k(i)){"closeLinear"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,i,a);var s=this.trackingEvents[e],o=this.emitAlwaysEvents.indexOf(e)>-1;s?(this.emit(e,{trackingURLTemplates:s}),this.trackURLs(s,i)):o&&this.emit(e,null),a&&(delete this.trackingEvents[e],o&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}else this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(i)})}},{key:"trackURLs",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=jt.filterUrlTemplates(e),a=r.validUrls,s=r.invalidUrls;s.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(s)});var o=l({},n);this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(o.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(o.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(t=t.universalAdIds)&&void 0!==t&&t.length&&(o.UNIVERSALADID=this.creative.universalAdIds.map(function(e){return e.idRegistry.concat(" ",e.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(function(e){return e.value}).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(o.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(function(e){return e.value}).join(","))),jt.track(a,o,i)}},{key:"convertToTimecode",value:function(e){if(!jt.isValidTimeValue(e))return"";var t=1e3*e,n=Math.floor(t/36e5),i=Math.floor(t/6e4%60),r=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(jt.addLeadingZeros(n,2),":").concat(jt.addLeadingZeros(i,2),":").concat(jt.addLeadingZeros(r,2),".").concat(jt.addLeadingZeros(a,3))}},{key:"progressFormatted",value:function(){return this.convertToTimecode(this.progress)}}])}(),Sn="undefined"!=typeof window?window:void 0!==F.commonjsGlobal?F.commonjsGlobal:"undefined"!=typeof self?self:{},wn=F.getDefaultExportFromCjs(Sn),En=Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})),Cn=F.getAugmentedNamespace(En),An=void 0!==F.commonjsGlobal?F.commonjsGlobal:"undefined"!=typeof window?window:{},In=Cn;"undefined"!=typeof document?on=document:(on=An["__GLOBAL_DOCUMENT_CACHE@4"])||(on=An["__GLOBAL_DOCUMENT_CACHE@4"]=In);var xn=on,Ln=F.getDefaultExportFromCjs(xn),Dn={exports:{}},Pn={exports:{}};!function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,t.apply(null,arguments)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Pn);var Rn=Pn.exports,On=function(e){if(!e)return!1;var t=Nn.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)},Nn=Object.prototype.toString;function Un(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Mn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Mn(e,t)}(e))||t){n&&(e=n);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Mn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var Bn=function(){function e(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var t=e.prototype;return t.getIsEnabled=function(){return this.enabled_},t.enable=function(){this.enabled_=!0},t.disable=function(){this.enabled_=!1},t.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},t.addInterceptor=function(e,t){this.typeToInterceptorsMap_.has(e)||this.typeToInterceptorsMap_.set(e,new Set);var n=this.typeToInterceptorsMap_.get(e);return!n.has(t)&&(n.add(t),!0)},t.removeInterceptor=function(e,t){var n=this.typeToInterceptorsMap_.get(e);return!(!n||!n.has(t))&&(n.delete(t),!0)},t.clearInterceptorsByType=function(e){return!!this.typeToInterceptorsMap_.get(e)&&(this.typeToInterceptorsMap_.delete(e),this.typeToInterceptorsMap_.set(e,new Set),!0)},t.clear=function(){return!!this.typeToInterceptorsMap_.size&&(this.typeToInterceptorsMap_=new Map,!0)},t.getForType=function(e){return this.typeToInterceptorsMap_.get(e)||new Set},t.execute=function(e,t){for(var n,i=Un(this.getForType(e));!(n=i()).done;){var r=n.value;try{t=r(t)}catch(a){}}return t},e}(),jn=function(){function e(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var t=e.prototype;return t.getIsEnabled=function(){return this.enabled_},t.enable=function(){this.enabled_=!0},t.disable=function(){this.enabled_=!1},t.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},t.getMaxAttempts=function(){return this.maxAttempts_},t.setMaxAttempts=function(e){this.maxAttempts_=e},t.getDelayFactor=function(){return this.delayFactor_},t.setDelayFactor=function(e){this.delayFactor_=e},t.getFuzzFactor=function(){return this.fuzzFactor_},t.setFuzzFactor=function(e){this.fuzzFactor_=e},t.getInitialDelay=function(){return this.initialDelay_},t.setInitialDelay=function(e){this.initialDelay_=e},t.createRetry=function(e){var t=void 0===e?{}:e,n=t.maxAttempts,i=t.delayFactor,r=t.fuzzFactor,a=t.initialDelay;return new Fn({maxAttempts:n||this.maxAttempts_,delayFactor:i||this.delayFactor_,fuzzFactor:r||this.fuzzFactor_,initialDelay:a||this.initialDelay_})},e}(),Fn=function(){function e(e){this.maxAttempts_=e.maxAttempts,this.delayFactor_=e.delayFactor,this.fuzzFactor_=e.fuzzFactor,this.currentDelay_=e.initialDelay,this.currentAttempt_=1}var t=e.prototype;return t.moveToNextAttempt=function(){this.currentAttempt_++;var e=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+e},t.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},t.getCurrentDelay=function(){return this.currentDelay_},t.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},t.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},t.getCurrentFuzzedDelay=function(){var e=this.getCurrentMinPossibleDelay(),t=this.getCurrentMaxPossibleDelay();return e+Math.random()*(t-e)},e}(),qn=Sn;var Vn=function(e,t){return void 0===t&&(t=!1),function(n,i,r){if(n)e(n);else if(i.statusCode>=400&&i.statusCode<=599){var a=r;if(t)if(qn.TextDecoder){var s=function(e){void 0===e&&(e="");return e.toLowerCase().split(";").reduce(function(e,t){var n=t.split("="),i=n[0],r=n[1];return"charset"===i.trim()?r.trim():e},"utf-8")}(i.headers&&i.headers["content-type"]);try{a=new TextDecoder(s).decode(r)}catch(o){}}else a=String.fromCharCode.apply(null,new Uint8Array(r));e({cause:a})}else e(null,r)}},Hn=Sn,zn=Rn,Wn=On,Gn=Bn,Xn=jn;Qn.httpHandler=Vn,Qn.requestInterceptorsStorage=new Gn,Qn.responseInterceptorsStorage=new Gn,Qn.retryManager=new Xn;
4
+ /**
5
+ * @license
6
+ * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
7
+ * Copyright (c) 2014 David Björklund
8
+ * Available under the MIT license
9
+ * <https://github.com/kesla/parse-headers/blob/master/LICENCE>
10
+ */
11
+ var Kn=function(e){var t={};return e?(e.trim().split("\n").forEach(function(e){var n=e.indexOf(":"),i=e.slice(0,n).trim().toLowerCase(),r=e.slice(n+1).trim();void 0===t[i]?t[i]=r:Array.isArray(t[i])?t[i].push(r):t[i]=[t[i],r]}),t):t};function Yn(e,t,n){var i=e;return Wn(t)?(n=t,"string"==typeof e&&(i={uri:e})):i=zn({},t,{uri:e}),i.callback=n,i}function Qn(e,t,n){return $n(t=Yn(e,t,n))}function $n(e){if(void 0===e.callback)throw new Error("callback argument missing");if(e.requestType&&Qn.requestInterceptorsStorage.getIsEnabled()){var t={uri:e.uri||e.url,headers:e.headers||{},body:e.body,metadata:e.metadata||{},retry:e.retry,timeout:e.timeout},n=Qn.requestInterceptorsStorage.execute(e.requestType,t);e.uri=n.uri,e.headers=n.headers,e.body=n.body,e.metadata=n.metadata,e.retry=n.retry,e.timeout=n.timeout}var i=!1,r=function(t,n,r){i||(i=!0,e.callback(t,n,r))};function a(){var e=void 0;if(e=c.response?c.response:c.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(n){}return null}(c),v)try{e=JSON.parse(e)}catch(t){}return e}function s(t){if(clearTimeout(d),clearTimeout(e.retryTimeout),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,l||!Qn.retryManager.getIsEnabled()||!e.retry||!e.retry.shouldRetry()){if(e.requestType&&Qn.responseInterceptorsStorage.getIsEnabled()){var n={headers:y.headers||{},body:y.body,responseUrl:c.responseURL,responseType:c.responseType},i=Qn.responseInterceptorsStorage.execute(e.requestType,n);y.body=i.body,y.headers=i.headers}return r(t,y)}e.retryTimeout=setTimeout(function(){e.retry.moveToNextAttempt(),e.xhr=c,$n(e)},e.retry.getCurrentFuzzedDelay())}function o(){if(!l){var t;clearTimeout(d),clearTimeout(e.retryTimeout),t=e.useXDR&&void 0===c.status?200:1223===c.status?204:c.status;var n=y,i=null;if(0!==t?(n={body:a(),statusCode:t,method:p,headers:{},url:h,rawRequest:c},c.getAllResponseHeaders&&(n.headers=Kn(c.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),e.requestType&&Qn.responseInterceptorsStorage.getIsEnabled()){var s={headers:n.headers||{},body:n.body,responseUrl:c.responseURL,responseType:c.responseType},o=Qn.responseInterceptorsStorage.execute(e.requestType,s);n.body=o.body,n.headers=o.headers}return r(i,n,n.body)}}var u,l,c=e.xhr||null;c||(c=e.cors||e.useXDR?new Qn.XDomainRequest:new Qn.XMLHttpRequest);var d,h=c.url=e.uri||e.url,p=c.method=e.method||"GET",f=e.body||e.data,m=c.headers=e.headers||{},g=!!e.sync,v=!1,y={body:void 0,headers:{},statusCode:0,method:p,url:h,rawRequest:c};if("json"in e&&!1!==e.json&&(v=!0,m.accept||m.Accept||(m.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(m["content-type"]||m["Content-Type"]||(m["Content-Type"]="application/json"),f=JSON.stringify(!0===e.json?f:e.json))),c.onreadystatechange=function(){4!==c.readyState||Qn.responseInterceptorsStorage.getIsEnabled()||setTimeout(o,0)},c.onload=o,c.onerror=s,c.onprogress=function(){},c.onabort=function(){l=!0,clearTimeout(e.retryTimeout)},c.ontimeout=s,c.open(p,h,!g,e.username,e.password),g||(c.withCredentials=!!e.withCredentials),!g&&e.timeout>0&&(d=setTimeout(function(){if(!l){l=!0,c.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",s(e)}},e.timeout)),c.setRequestHeader)for(u in m)m.hasOwnProperty(u)&&c.setRequestHeader(u,m[u]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(c.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(c),c.send(f||null),c}Dn.exports=Qn,Dn.exports.default=Qn,Qn.XMLHttpRequest=Hn.XMLHttpRequest||function(){},Qn.XDomainRequest="withCredentials"in new Qn.XMLHttpRequest?Qn.XMLHttpRequest:Hn.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){Qn["delete"===e?"del":e]=function(t,n,i){return(n=Yn(t,n,i)).method=e.toUpperCase(),$n(n)}});var Jn=Dn.exports,Zn=F.getDefaultExportFromCjs(Jn),ei={exports:{}},ti=xn,ni=Object.create||function(){function e(){}return function(t){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return e.prototype=t,new e}}();function ii(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function ri(e){function t(e,t,n,i){return 3600*(0|e)+60*(0|t)+(0|n)+(0|i)/1e3}var n=e.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return n?n[3]?t(n[1],n[2],n[3].replace(":",""),n[4]):n[1]>59?t(n[1],n[2],0,n[4]):t(0,n[1],n[2],n[4]):null}function ai(){this.values=ni(null)}function si(e,t,n,i){var r=i?e.split(i):[e];for(var a in r)if("string"==typeof r[a]){var s=r[a].split(n);if(2===s.length)t(s[0].trim(),s[1].trim())}}function oi(e,t,n){var i=e;function r(){var t=ri(e);if(null===t)throw new ii(ii.Errors.BadTimeStamp,"Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.substr(0,3))throw new ii(ii.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.substr(3),a(),t.endTime=r(),a(),function(e,t){var i=new ai;si(e,function(e,t){switch(e){case"region":for(var r=n.length-1;r>=0;r--)if(n[r].id===t){i.set(e,n[r].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),s=a[0];i.integer(e,s),i.percent(e,s)&&i.set("snapToLines",!1),i.alt(e,s,["auto"]),2===a.length&&i.alt("lineAlign",a[1],["start","center","end"]);break;case"position":a=t.split(","),i.percent(e,a[0]),2===a.length&&i.alt("positionAlign",a[1],["start","center","end"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start","center","end","left","right"])}},/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");try{t.line=i.get("line","auto")}catch(r){}t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100);try{t.align=i.get("align","center")}catch(r){t.align=i.get("align","middle")}try{t.position=i.get("position","auto")}catch(r){t.position=i.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=i.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}ii.prototype=ni(Error.prototype),ii.prototype.constructor=ii,ii.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},ai.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,n){return n?this.has(e)?this.values[e]:t[n]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,n){for(var i=0;i<n.length;++i)if(t===n[i]){this.set(e,t);break}},integer:function(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))},percent:function(e,t){return!!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(t=parseFloat(t))>=0&&t<=100)&&(this.set(e,t),!0)}};var ui=ti.createElement&&ti.createElement("textarea"),li={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},ci={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)"},di={v:"title",lang:"lang"},hi={rt:"ruby"};function pi(e,t){function n(){if(!t)return null;var e,n=t.match(/^([^<]*)(<[^>]*>?)?/);return e=n[1]?n[1]:n[2],t=t.substr(e.length),e}function i(e){return ui.innerHTML=e,e=ui.textContent,ui.textContent="",e}function r(e,t){return!hi[t.localName]||hi[t.localName]===e.localName}function a(t,n){var i=li[t];if(!i)return null;var r=e.document.createElement(i),a=di[t];return a&&n&&(r[a]=n.trim()),r}for(var s,o=e.document.createElement("div"),u=o,l=[];null!==(s=n());)if("<"!==s[0])u.appendChild(e.document.createTextNode(i(s)));else{if("/"===s[1]){l.length&&l[l.length-1]===s.substr(2).replace(">","")&&(l.pop(),u=u.parentNode);continue}var c,d=ri(s.substr(1,s.length-2));if(d){c=e.document.createProcessingInstruction("timestamp",d),u.appendChild(c);continue}var h=s.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!h)continue;if(!(c=a(h[1],h[3])))continue;if(!r(u,c))continue;if(h[2]){var p=h[2].split(".");p.forEach(function(e){var t=/^bg_/.test(e),n=t?e.slice(3):e;if(ci.hasOwnProperty(n)){var i=t?"background-color":"color",r=ci[n];c.style[i]=r}}),c.className=p.join(" ")}l.push(h[1]),u.appendChild(c),u=c}return o}var fi=[[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 mi(e){for(var t=0;t<fi.length;t++){var n=fi[t];if(e>=n[0]&&e<=n[1])return!0}return!1}function gi(e){var t=[],n="";if(!e||!e.childNodes)return"ltr";function i(e,t){for(var n=t.childNodes.length-1;n>=0;n--)e.push(t.childNodes[n])}function r(e){if(!e||!e.length)return null;var t=e.pop(),n=t.textContent||t.innerText;if(n){var a=n.match(/^.*(\n|\r)/);return a?(e.length=0,a[0]):n}return"ruby"===t.tagName?r(e):t.childNodes?(i(e,t),r(e)):void 0}for(i(t,e);n=r(t);)for(var a=0;a<n.length;a++)if(mi(n.charCodeAt(a)))return"rtl";return"ltr"}function vi(){}function yi(e,t,n){vi.call(this),this.cue=t,this.cueDiv=pi(e,t.text);var i={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(i,this.cueDiv),this.div=e.document.createElement("div"),i={direction:gi(this.cueDiv),writingMode:""===t.vertical?"horizontal-tb":"lr"===t.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===t.align?"center":t.align,font:n.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(i),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":case"line-left":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":case"line-right":r=t.position-t.size}""===t.vertical?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")}),this.move=function(e){this.applyStyles({top:this.formatStyle(e.top,"px"),bottom:this.formatStyle(e.bottom,"px"),left:this.formatStyle(e.left,"px"),right:this.formatStyle(e.right,"px"),height:this.formatStyle(e.height,"px"),width:this.formatStyle(e.width,"px")})}}function _i(e){var t,n,i,r;if(e.div){n=e.div.offsetHeight,i=e.div.offsetWidth,r=e.div.offsetTop;var a=(a=e.div.childNodes)&&(a=a[0])&&a.getClientRects&&a.getClientRects();e=e.div.getBoundingClientRect(),t=a?Math.max(a[0]&&a[0].height||0,e.height/a.length):0}this.left=e.left,this.right=e.right,this.top=e.top||r,this.height=e.height||n,this.bottom=e.bottom||r+(e.height||n),this.width=e.width||i,this.lineHeight=void 0!==t?t:e.lineHeight}function bi(e,t,n,i){var r=new _i(t),a=t.cue,s=function(e){if("number"==typeof e.line&&(e.snapToLines||e.line>=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,n=t.textTrackList,i=0,r=0;r<n.length&&n[r]!==t;r++)"showing"===n[r].mode&&i++;return-1*++i}(a),o=[];if(a.snapToLines){var u;switch(a.vertical){case"":o=["+y","-y"],u="height";break;case"rl":o=["+x","-x"],u="width";break;case"lr":o=["-x","+x"],u="width"}var l=r.lineHeight,c=l*Math.round(s),d=n[u]+l,h=o[0];Math.abs(c)>d&&(c=c<0?-1:1,c*=Math.ceil(d/l)*l),s<0&&(c+=""===a.vertical?n.height:n.width,o=o.reverse()),r.move(h,c)}else{var p=r.lineHeight/n.height*100;switch(a.lineAlign){case"center":s-=p/2;break;case"end":s-=p}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(s,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}o=["+y","-x","+x","-y"],r=new _i(t)}var f=function(e,t){for(var r,a=new _i(e),s=1,o=0;o<t.length;o++){for(;e.overlapsOppositeAxis(n,t[o])||e.within(n)&&e.overlapsAny(i);)e.move(t[o]);if(e.within(n))return e;var u=e.intersectPercentage(n);s>u&&(r=new _i(e),s=u),e=new _i(a)}return r||a}(r,o);t.move(f.toCSSCompatValues(n))}function Ti(){}vi.prototype.applyStyles=function(e,t){for(var n in t=t||this.div,e)e.hasOwnProperty(n)&&(t.style[n]=e[n])},vi.prototype.formatStyle=function(e,t){return 0===e?0:e+t},yi.prototype=ni(vi.prototype),yi.prototype.constructor=yi,_i.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},_i.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},_i.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},_i.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},_i.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.left<e.left;case"-x":return this.right>e.right;case"+y":return this.top<e.top;case"-y":return this.bottom>e.bottom}},_i.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},_i.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},_i.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,n=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,i=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||i,height:e.height||t,bottom:e.bottom||i+(e.height||t),width:e.width||n}},Ti.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Ti.convertCueToDOMTree=function(e,t){return e&&t?pi(e,t):null};Ti.processCues=function(e,t,n){if(!e||!t||!n)return null;for(;n.firstChild;)n.removeChild(n.firstChild);var i=e.document.createElement("div");if(i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.margin="1.5%",n.appendChild(i),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return!0;return!1}(t)){var r=[],a=_i.getSimpleBoxPosition(i),s={font:Math.round(.05*a.height*100)/100+"px sans-serif"};!function(){for(var n,o,u=0;u<t.length;u++)o=t[u],n=new yi(e,o,s),i.appendChild(n.div),bi(0,n,a,r),o.displayState=n.div,r.push(_i.getSimpleBoxPosition(n))}()}else for(var o=0;o<t.length;o++)i.appendChild(t[o].displayState)},Ti.Parser=function(e,t,n){n||(n=t,t={}),t||(t={}),this.window=e,this.vttjs=t,this.state="INITIAL",this.buffer="",this.decoder=n||new TextDecoder("utf8"),this.regionList=[]},Ti.Parser.prototype={reportOrThrowError:function(e){if(!(e instanceof ii))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var t=this;function n(){for(var e=t.buffer,n=0;n<e.length&&"\r"!==e[n]&&"\n"!==e[n];)++n;var i=e.substr(0,n);return"\r"===e[n]&&++n,"\n"===e[n]&&++n,t.buffer=e.substr(n),i}function i(e){e.match(/X-TIMESTAMP-MAP/)?si(e,function(e,n){if("X-TIMESTAMP-MAP"===e)!function(e){var n=new ai;si(e,function(e,t){switch(e){case"MPEGT":n.integer(e+"S",t);break;case"LOCA":n.set(e+"L",ri(t))}},/[^\d]:/,/,/),t.ontimestampmap&&t.ontimestampmap({MPEGTS:n.get("MPEGTS"),LOCAL:n.get("LOCAL")})}(n)},/=/):si(e,function(e,n){if("Region"===e)!function(e){var n=new ai;if(si(e,function(e,t){switch(e){case"id":n.set(e,t);break;case"width":n.percent(e,t);break;case"lines":n.integer(e,t);break;case"regionanchor":case"viewportanchor":var i=t.split(",");if(2!==i.length)break;var r=new ai;if(r.percent("x",i[0]),r.percent("y",i[1]),!r.has("x")||!r.has("y"))break;n.set(e+"X",r.get("x")),n.set(e+"Y",r.get("y"));break;case"scroll":n.alt(e,t,["up"])}},/=/,/\s/),n.has("id")){var i=new(t.vttjs.VTTRegion||t.window.VTTRegion);i.width=n.get("width",100),i.lines=n.get("lines",3),i.regionAnchorX=n.get("regionanchorX",0),i.regionAnchorY=n.get("regionanchorY",100),i.viewportAnchorX=n.get("viewportanchorX",0),i.viewportAnchorY=n.get("viewportanchorY",100),i.scroll=n.get("scroll",""),t.onregion&&t.onregion(i),t.regionList.push({id:n.get("id"),region:i})}}(n)},/:/)}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{var r;if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;var a=(r=n()).match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new ii(ii.Errors.BadSignature);t.state="HEADER"}for(var s=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(s?s=!1:r=n(),t.state){case"HEADER":/:/.test(r)?i(r):r||(t.state="ID");continue;case"NOTE":r||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){t.state="NOTE";break}if(!r)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(u){t.cue.align="middle"}if(t.state="CUE",-1===r.indexOf("--\x3e")){t.cue.id=r;continue}case"CUE":try{oi(r,t.cue,t.regionList)}catch(u){t.reportOrThrowError(u),t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(s=!0)){t.oncue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}t.cue.text&&(t.cue.text+="\n"),t.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(t.state="ID");continue}}}catch(u){t.reportOrThrowError(u),"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var e=this;try{if(e.buffer+=e.decoder.decode(),(e.cue||"HEADER"===e.state)&&(e.buffer+="\n\n",e.parse()),"INITIAL"===e.state)throw new ii(ii.Errors.BadSignature)}catch(t){e.reportOrThrowError(t)}return e.onflush&&e.onflush(),this}};var ki=Ti,Si={"":1,lr:1,rl:1},wi={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Ei(e){return"string"==typeof e&&(!!wi[e.toLowerCase()]&&e.toLowerCase())}function Ci(e,t,n){this.hasBeenReset=!1;var i="",r=!1,a=e,s=t,o=n,u=null,l="",c=!0,d="auto",h="start",p="auto",f="auto",m=100,g="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return i},set:function(e){i=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");a=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");s=e,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(e){o=""+e,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(e){u=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return l},set:function(e){var t=function(e){return"string"==typeof e&&!!Si[e.toLowerCase()]&&e.toLowerCase()}(e);if(!1===t)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");l=t,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(e){c=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return d},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");d=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return h},set:function(e){var t=Ei(e);t?(h=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return p},set:function(e){if(e<0||e>100)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(e){var t=Ei(e);t?(f=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");m=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){var t=Ei(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}Ci.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Ai=Ci,Ii={"":!0,up:!0};function xi(e){return"number"==typeof e&&e>=0&&e<=100}var Li=function(){var e=100,t=3,n=0,i=100,r=0,a=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!xi(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!=typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return i},set:function(e){if(!xi(e))throw new Error("RegionAnchorX must be between 0 and 100.");i=e}},regionAnchorX:{enumerable:!0,get:function(){return n},set:function(e){if(!xi(e))throw new Error("RegionAnchorY must be between 0 and 100.");n=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!xi(e))throw new Error("ViewportAnchorY must be between 0 and 100.");a=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!xi(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=function(e){return"string"==typeof e&&!!Ii[e.toLowerCase()]&&e.toLowerCase()}(e);!1===t?console.warn("Scroll: an invalid or illegal string was specified."):s=t}}})},Di=Sn,Pi=ei.exports={WebVTT:ki,VTTCue:Ai,VTTRegion:Li};Di.vttjs=Pi,Di.WebVTT=Pi.WebVTT;var Ri=Pi.VTTCue,Oi=Pi.VTTRegion,Ni=Di.VTTCue,Ui=Di.VTTRegion;Pi.shim=function(){Di.VTTCue=Ri,Di.VTTRegion=Oi},Pi.restore=function(){Di.VTTCue=Ni,Di.VTTRegion=Ui},Di.VTTCue||Pi.shim();for(var Mi=ei.exports,Bi=F.getDefaultExportFromCjs(Mi),ji="https://example.com",Fi=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=wn.location&&wn.location.href||"");var n=/^\/\//.test(e),i=!wn.location&&!/\/\//i.test(e);e=new wn.URL(e,wn.location||ji);var r=new URL(t,e);return i?r.href.slice(19):n?r.href.slice(r.protocol.length):r.href},qi=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var n=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(n,1),n>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var n=t.length,i=0;i<n;++i)t[i].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",function(t){e.push(t)})},e}(),Vi={},Hi={byteLength:function(e){var t=Yi(e),n=t[0],i=t[1];return 3*(n+i)/4-i},toByteArray:function(e){var t,n,i=Yi(e),r=i[0],a=i[1],s=new Gi(function(e,t,n){return 3*(t+n)/4-n}(0,r,a)),o=0,u=a>0?r-4:r;for(n=0;n<u;n+=4)t=Wi[e.charCodeAt(n)]<<18|Wi[e.charCodeAt(n+1)]<<12|Wi[e.charCodeAt(n+2)]<<6|Wi[e.charCodeAt(n+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=255&t;2===a&&(t=Wi[e.charCodeAt(n)]<<2|Wi[e.charCodeAt(n+1)]>>4,s[o++]=255&t);1===a&&(t=Wi[e.charCodeAt(n)]<<10|Wi[e.charCodeAt(n+1)]<<4|Wi[e.charCodeAt(n+2)]>>2,s[o++]=t>>8&255,s[o++]=255&t);return s},fromByteArray:function(e){for(var t,n=e.length,i=n%3,r=[],a=16383,s=0,o=n-i;s<o;s+=a)r.push($i(e,s,s+a>o?o:s+a));1===i?(t=e[n-1],r.push(zi[t>>2]+zi[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],r.push(zi[t>>10]+zi[t>>4&63]+zi[t<<2&63]+"="));return r.join("")}},zi=[],Wi=[],Gi="undefined"!=typeof Uint8Array?Uint8Array:Array,Xi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ki=0;Ki<64;++Ki)zi[Ki]=Xi[Ki],Wi[Xi.charCodeAt(Ki)]=Ki;function Yi(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function Qi(e){return zi[e>>18&63]+zi[e>>12&63]+zi[e>>6&63]+zi[63&e]}function $i(e,t,n){for(var i,r=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),r.push(Qi(i));return r.join("")}Wi["-".charCodeAt(0)]=62,Wi["_".charCodeAt(0)]=63;var Ji={
12
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
13
+ read:function(e,t,n,i,r){var a,s,o=8*r-i-1,u=(1<<o)-1,l=u>>1,c=-7,d=n?r-1:0,h=n?-1:1,p=e[t+d];for(d+=h,a=p&(1<<-c)-1,p>>=-c,c+=o;c>0;a=256*a+e[t+d],d+=h,c-=8);for(s=a&(1<<-c)-1,a>>=-c,c+=i;c>0;s=256*s+e[t+d],d+=h,c-=8);if(0===a)a=1-l;else{if(a===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,i),a-=l}return(p?-1:1)*s*Math.pow(2,a-i)},write:function(e,t,n,i,r,a){var s,o,u,l=8*a-r-1,c=(1<<l)-1,d=c>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:a-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+d>=1?h/u:h*Math.pow(2,1-d))*u>=2&&(s++,u/=2),s+d>=c?(o=0,s=c):s+d>=1?(o=(t*u-1)*Math.pow(2,r),s+=d):(o=t*Math.pow(2,d-1)*Math.pow(2,r),s=0));r>=8;e[n+p]=255&o,p+=f,o/=256,r-=8);for(s=s<<r|o,l+=r;l>0;e[n+p]=255&s,p+=f,s/=256,l-=8);e[n+p-f]|=128*m}};
14
+ /*!
15
+ * The buffer module from node.js, for the browser.
16
+ *
17
+ * @author Feross Aboukhadijeh <https://feross.org>
18
+ * @license MIT
19
+ */
20
+ !function(e){var t=Hi,n=Ji,i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=l,e.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},e.INSPECT_MAX_BYTES=50;var r=2147483647;e.kMaxLength=r;var a=globalThis.Uint8Array,s=globalThis.ArrayBuffer,o=globalThis.SharedArrayBuffer;function u(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new a(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return p(e)}return d(e,t,n)}function d(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|b(e,t),i=u(n),r=i.write(e,t);r!==n&&(i=i.slice(0,r));return i}(e,t);if(s.isView(e))return function(e){if(te(e,a)){var t=new a(e);return v(t.buffer,t.byteOffset,t.byteLength)}return m(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+k(e));if(te(e,s)||e&&te(e.buffer,s))return v(e,t,n);if(void 0!==o&&(te(e,o)||e&&te(e.buffer,o)))return v(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return l.from(i,t,n);var r=function(e){if(l.isBuffer(e)){var t=0|_(e.length),n=u(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||ne(e.length)?u(0):m(e);if("Buffer"===e.type&&Array.isArray(e.data))return m(e.data)}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+k(e))}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function p(e){return h(e),u(e<0?0:0|_(e))}function m(e){for(var t=e.length<0?0:0|_(e.length),n=u(t),i=0;i<t;i+=1)n[i]=255&e[i];return n}function v(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var i;return i=void 0===t&&void 0===n?new a(e):void 0===n?new a(e,t):new a(e,t,n),Object.setPrototypeOf(i,l.prototype),i}function _(e){if(e>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function b(e,t){if(l.isBuffer(e))return e.length;if(s.isView(e)||te(e,s))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+k(e));var n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(r)return i?-1:J(e).length;t=(""+t).toLowerCase(),r=!0}}function T(e,t,n){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,n);case"utf8":case"utf-8":return P(this,t,n);case"ascii":return O(this,t,n);case"latin1":case"binary":return N(this,t,n);case"base64":return D(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function S(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function w(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),ne(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:E(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof a.prototype.indexOf?r?a.prototype.indexOf.call(e,t,n):a.prototype.lastIndexOf.call(e,t,n):E(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function E(e,t,n,i,r){var a,s=1,o=e.length,u=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;s=2,o/=2,u/=2,n/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(r){var c=-1;for(a=n;a<o;a++)if(l(e,a)===l(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===u)return c*s}else-1!==c&&(a-=a-c),c=-1}else for(n+u>o&&(n=o-u),a=n;a>=0;a--){for(var d=!0,h=0;h<u;h++)if(l(e,a+h)!==l(t,h)){d=!1;break}if(d)return a}return-1}function C(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;var a,s=t.length;for(i>s/2&&(i=s/2),a=0;a<i;++a){var o=parseInt(t.substr(2*a,2),16);if(ne(o))return a;e[n+a]=o}return a}function A(e,t,n,i){return ee(J(t,e.length-n),e,n,i)}function I(e,t,n,i){return ee(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function x(e,t,n,i){return ee(Z(t),e,n,i)}function L(e,t,n,i){return ee(function(e,t){for(var n,i,r,a=[],s=0;s<e.length&&!((t-=2)<0);++s)i=(n=e.charCodeAt(s))>>8,r=n%256,a.push(r),a.push(i);return a}(t,e.length-n),e,n,i)}function D(e,n,i){return 0===n&&i===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,i))}function P(e,t,n){n=Math.min(e.length,n);for(var i=[],r=t;r<n;){var a=e[r],s=null,o=a>239?4:a>223?3:a>191?2:1;if(r+o<=n){var u=void 0,l=void 0,c=void 0,d=void 0;switch(o){case 1:a<128&&(s=a);break;case 2:128==(192&(u=e[r+1]))&&(d=(31&a)<<6|63&u)>127&&(s=d);break;case 3:u=e[r+1],l=e[r+2],128==(192&u)&&128==(192&l)&&(d=(15&a)<<12|(63&u)<<6|63&l)>2047&&(d<55296||d>57343)&&(s=d);break;case 4:u=e[r+1],l=e[r+2],c=e[r+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(d=(15&a)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&d<1114112&&(s=d)}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=o}return function(e){var t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);var n="",i=0;for(;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=R));return n}(i)}l.TYPED_ARRAY_SUPPORT=function(){try{var e=new a(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,a.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(n){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,n){return d(e,t,n)},Object.setPrototypeOf(l.prototype,a.prototype),Object.setPrototypeOf(l,a),l.alloc=function(e,t,n){return function(e,t,n){return h(e),e<=0?u(e):void 0!==t?"string"==typeof n?u(e).fill(t,n):u(e).fill(t):u(e)}(e,t,n)},l.allocUnsafe=function(e){return p(e)},l.allocUnsafeSlow=function(e){return p(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(te(e,a)&&(e=l.from(e,e.offset,e.byteLength)),te(t,a)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,i=t.length,r=0,s=Math.min(n,i);r<s;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},l.isEncoding=function(e){switch(String(e).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}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=l.allocUnsafe(t),r=0;for(n=0;n<e.length;++n){var s=e[n];if(te(s,a))r+s.length>i.length?(l.isBuffer(s)||(s=l.from(s)),s.copy(i,r)):a.prototype.set.call(i,s,r);else{if(!l.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,r)}r+=s.length}return i},l.byteLength=b,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)S(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)S(this,t,t+3),S(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)S(this,t,t+7),S(this,t+1,t+6),S(this,t+2,t+5),S(this,t+3,t+4);return this},l.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?P(this,0,e):T.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},i&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=function(e,t,n,i,r){if(te(e,a)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+k(e));if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(t>>>=0),u=Math.min(s,o),c=this.slice(i,r),d=e.slice(t,n),h=0;h<u;++h)if(c[h]!==d[h]){s=c[h],o=d[h];break}return s<o?-1:o<s?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)},l.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return C(this,e,t,n);case"utf8":case"utf-8":return A(this,e,t,n);case"ascii":case"latin1":case"binary":return I(this,e,t,n);case"base64":return x(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function O(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function N(e,t,n){var i="";n=Math.min(e.length,n);for(var r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function U(e,t,n){var i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var r="",a=t;a<n;++a)r+=ie[e[a]];return r}function M(e,t,n){for(var i=e.slice(t,n),r="",a=0;a<i.length-1;a+=2)r+=String.fromCharCode(i[a]+256*i[a+1]);return r}function B(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,n,i,r,a){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<a)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function F(e,t,n,i,r){K(t,i,r,e,n,7);var a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;var s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function q(e,t,n,i,r){K(t,i,r,e,n,7);var a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;var s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function V(e,t,n,i,r,a){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function H(e,t,i,r,a){return t=+t,i>>>=0,a||V(e,0,i,4),n.write(e,t,i,r,23,4),i+4}function z(e,t,i,r,a){return t=+t,i>>>=0,a||V(e,0,i,8),n.write(e,t,i,r,52,8),i+8}l.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var i=this.subarray(e,t);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);for(var i=this[e],r=1,a=0;++a<t&&(r*=256);)i+=this[e+a]*r;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);for(var i=this[e+--t],r=1;t>0&&(r*=256);)i+=this[e+--t]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=re(function(e){Y(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);var i=t+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,24),r=this[++e]+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+n*Math.pow(2,24);return BigInt(i)+(BigInt(r)<<BigInt(32))}),l.prototype.readBigUInt64BE=re(function(e){Y(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);var i=t*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+this[++e],r=this[++e]*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+n;return(BigInt(i)<<BigInt(32))+BigInt(r)}),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);for(var i=this[e],r=1,a=0;++a<t&&(r*=256);)i+=this[e+a]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);for(var i=t,r=1,a=this[e+--i];i>0&&(r*=256);)a+=this[e+--i]*r;return a>=(r*=128)&&(a-=Math.pow(2,8*t)),a},l.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=re(function(e){Y(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);var i=this[e+4]+this[e+5]*Math.pow(2,8)+this[e+6]*Math.pow(2,16)+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,24))}),l.prototype.readBigInt64BE=re(function(e){Y(e>>>=0,"offset");var t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);var i=(t<<24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+n)}),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,i){(e=+e,t>>>=0,n>>>=0,i)||j(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,a=0;for(this[t]=255&e;++a<n&&(r*=256);)this[t+a]=e/r&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,i){(e=+e,t>>>=0,n>>>=0,i)||j(this,e,t,n,Math.pow(2,8*n)-1,0);var r=n-1,a=1;for(this[t+r]=255&e;--r>=0&&(a*=256);)this[t+r]=e/a&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=re(function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=re(function(e){return q(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){var r=Math.pow(2,8*n-1);j(this,e,t,n,r-1,-r)}var a=0,s=1,o=0;for(this[t]=255&e;++a<n&&(s*=256);)e<0&&0===o&&0!==this[t+a-1]&&(o=1),this[t+a]=(e/s|0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){var r=Math.pow(2,8*n-1);j(this,e,t,n,r-1,-r)}var a=n-1,s=1,o=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===o&&0!==this[t+a+1]&&(o=1),this[t+a]=(e/s|0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=re(function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=re(function(e){return q(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeFloatLE=function(e,t,n){return H(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return H(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,i){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var r=i-n;return this===e&&"function"==typeof a.prototype.copyWithin?this.copyWithin(t,n,i):a.prototype.set.call(e,this.subarray(n,i),t),r},l.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){var r=e.charCodeAt(0);("utf8"===i&&r<128||"latin1"===i)&&(e=r)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var s=l.isBuffer(e)?e:l.from(e,i),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-t;++a)this[a+t]=s[a%o]}return this};var W={};function G(e,t,n){W[e]=function(n){function i(){var n;return g(this,i),n=c(this,i),Object.defineProperty(n,"message",{value:t.apply(n,arguments),writable:!0,configurable:!0}),n.name="".concat(n.name," [").concat(e,"]"),n.stack,delete n.name,n}return f(i,n),y(i,[{key:"code",get:function(){return e},set:function(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}},{key:"toString",value:function(){return"".concat(this.name," [").concat(e,"]: ").concat(this.message)}}])}(n)}function X(e){for(var t="",n=e.length,i="-"===e[0]?1:0;n>=i+4;n-=3)t="_".concat(e.slice(n-3,n)).concat(t);return"".concat(e.slice(0,n)).concat(t)}function K(e,t,n,i,r,a){if(e>n||e<t){var s,o="bigint"==typeof t?"n":"";throw s=0===t||t===BigInt(0)?">= 0".concat(o," and < 2").concat(o," ** ").concat(8*(a+1)).concat(o):">= -(2".concat(o," ** ").concat(8*(a+1)-1).concat(o,") and < 2 ** ")+"".concat(8*(a+1)-1).concat(o),new W.ERR_OUT_OF_RANGE("value",s,e)}!function(e,t,n){Y(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||Q(t,e.length-(n+1))}(i,r,a)}function Y(e,t){if("number"!=typeof e)throw new W.ERR_INVALID_ARG_TYPE(t,"number",e)}function Q(e,t,n){if(Math.floor(e)!==e)throw Y(e,n),new W.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new W.ERR_BUFFER_OUT_OF_BOUNDS;throw new W.ERR_OUT_OF_RANGE("offset",">= ".concat(0," and <= ",t),e)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(k(t))},TypeError),G("ERR_OUT_OF_RANGE",function(e,t,n){var i='The value of "'.concat(e,'" is out of range.'),r=n;return Number.isInteger(n)&&Math.abs(n)>Math.pow(2,32)?r=X(String(n)):"bigint"==typeof n&&(r=String(n),(n>Math.pow(BigInt(2),BigInt(32))||n<-Math.pow(BigInt(2),BigInt(32)))&&(r=X(r)),r+="n"),i+=" It must be ".concat(t,". Received ").concat(r)},RangeError);var $=/[^+/0-9A-Za-z-_]/g;function J(e,t){var n;t=t||1/0;for(var i=e.length,r=null,a=[],s=0;s<i;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===i){(t-=3)>-1&&a.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&a.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function Z(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ee(e,t,n,i){var r;for(r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function te(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function ne(e){return e!=e}var ie=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var i=16*n,r=0;r<16;++r)t[i+r]=e[n]+e[r];return t}();function re(e){return"undefined"==typeof BigInt?ae:e}function ae(){throw new Error("BigInt not supported")}}(Vi);var Zi=Vi.Buffer;function er(e){for(var t,n=(t=e,wn.atob?wn.atob(t):Zi.from(t,"base64").toString("binary")),i=new Uint8Array(n.length),r=0;r<n.length;r++)i[r]=n.charCodeAt(r);return i}
21
+ /*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */var tr,nr,ir=function(){function e(){var t;return g(this,e),(t=c(this,e)).buffer="",t}return f(e,qi),y(e,[{key:"push",value:function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}])}(),rr=String.fromCharCode(9),ar=function(e){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),n={};return t[1]&&(n.length=parseInt(t[1],10)),t[2]&&(n.offset=parseInt(t[2],10)),n},sr=function(e){var t={};if(!e)return t;for(var n,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),r=i.length;r--;)""!==i[r]&&((n=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),t[n[0]]=n[1]);return t},or=function(e){var t=e.split("x"),n={};return t[0]&&(n.width=parseInt(t[0],10)),t[1]&&(n.height=parseInt(t[1],10)),n},ur=function(){function e(){var t;return g(this,e),(t=c(this,e)).customParsers=[],t.tagMappers=[],t}return f(e,qi),y(e,[{key:"push",value:function(e){var t,n,i=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce(function(t,n){var i=n(e);return i===e?t:t.concat([i])},[e]).forEach(function(e){for(var r=0;r<i.customParsers.length;r++)if(i.customParsers[r].call(i,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),t=/^#EXTM3U/.exec(e))i.trigger("data",{type:"tag",tagType:"m3u"});else{if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(e))return n={type:"tag",tagType:"inf"},t[1]&&(n.duration=parseFloat(t[1])),t[2]&&(n.title=t[2]),void i.trigger("data",n);if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"targetduration"},t[1]&&(n.duration=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(e))return n={type:"tag",tagType:"version"},t[1]&&(n.version=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(e))return n={type:"tag",tagType:"media-sequence"},t[1]&&(n.number=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(e))return n={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(n.number=parseInt(t[1],10)),void i.trigger("data",n);if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(e))return n={type:"tag",tagType:"playlist-type"},t[1]&&(n.playlistType=t[1]),void i.trigger("data",n);if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(e))return n=$(ar(t[1]),{type:"tag",tagType:"byterange"}),void i.trigger("data",n);if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(e))return n={type:"tag",tagType:"allow-cache"},t[1]&&(n.allowed=!/NO/.test(t[1])),void i.trigger("data",n);if(t=/^#EXT-X-MAP:(.*)$/.exec(e)){if(n={type:"tag",tagType:"map"},t[1]){var a=sr(t[1]);a.URI&&(n.uri=a.URI),a.BYTERANGE&&(n.byterange=ar(a.BYTERANGE))}i.trigger("data",n)}else{if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(e))return n={type:"tag",tagType:"stream-inf"},t[1]&&(n.attributes=sr(t[1]),n.attributes.RESOLUTION&&(n.attributes.RESOLUTION=or(n.attributes.RESOLUTION)),n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes["FRAME-RATE"]&&(n.attributes["FRAME-RATE"]=parseFloat(n.attributes["FRAME-RATE"])),n.attributes["PROGRAM-ID"]&&(n.attributes["PROGRAM-ID"]=parseInt(n.attributes["PROGRAM-ID"],10))),void i.trigger("data",n);if(t=/^#EXT-X-MEDIA:(.*)$/.exec(e))return n={type:"tag",tagType:"media"},t[1]&&(n.attributes=sr(t[1])),void i.trigger("data",n);if(t=/^#EXT-X-ENDLIST/.exec(e))i.trigger("data",{type:"tag",tagType:"endlist"});else if(t=/^#EXT-X-DISCONTINUITY/.exec(e))i.trigger("data",{type:"tag",tagType:"discontinuity"});else{if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(e))return n={type:"tag",tagType:"program-date-time"},t[1]&&(n.dateTimeString=t[1],n.dateTimeObject=new Date(t[1])),void i.trigger("data",n);if(t=/^#EXT-X-KEY:(.*)$/.exec(e))return n={type:"tag",tagType:"key"},t[1]&&(n.attributes=sr(t[1]),n.attributes.IV&&("0x"===n.attributes.IV.substring(0,2).toLowerCase()&&(n.attributes.IV=n.attributes.IV.substring(2)),n.attributes.IV=n.attributes.IV.match(/.{8}/g),n.attributes.IV[0]=parseInt(n.attributes.IV[0],16),n.attributes.IV[1]=parseInt(n.attributes.IV[1],16),n.attributes.IV[2]=parseInt(n.attributes.IV[2],16),n.attributes.IV[3]=parseInt(n.attributes.IV[3],16),n.attributes.IV=new Uint32Array(n.attributes.IV))),void i.trigger("data",n);if(t=/^#EXT-X-START:(.*)$/.exec(e))return n={type:"tag",tagType:"start"},t[1]&&(n.attributes=sr(t[1]),n.attributes["TIME-OFFSET"]=parseFloat(n.attributes["TIME-OFFSET"]),n.attributes.PRECISE=/YES/.test(n.attributes.PRECISE)),void i.trigger("data",n);if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-out-cont"},t[1]?n.data=t[1]:n.data="",void i.trigger("data",n);if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-out"},t[1]?n.data=t[1]:n.data="",void i.trigger("data",n);if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))return n={type:"tag",tagType:"cue-in"},t[1]?n.data=t[1]:n.data="",void i.trigger("data",n);if((t=/^#EXT-X-SKIP:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"skip"}).attributes=sr(t[1]),n.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(n.attributes["SKIPPED-SEGMENTS"]=parseInt(n.attributes["SKIPPED-SEGMENTS"],10)),n.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(n.attributes["RECENTLY-REMOVED-DATERANGES"]=n.attributes["RECENTLY-REMOVED-DATERANGES"].split(rr)),void i.trigger("data",n);if((t=/^#EXT-X-PART:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"part"}).attributes=sr(t[1]),["DURATION"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=parseFloat(n.attributes[e]))}),["INDEPENDENT","GAP"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=/YES/.test(n.attributes[e]))}),n.attributes.hasOwnProperty("BYTERANGE")&&(n.attributes.byterange=ar(n.attributes.BYTERANGE)),void i.trigger("data",n);if((t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"server-control"}).attributes=sr(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=parseFloat(n.attributes[e]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=/YES/.test(n.attributes[e]))}),void i.trigger("data",n);if((t=/^#EXT-X-PART-INF:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"part-inf"}).attributes=sr(t[1]),["PART-TARGET"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=parseFloat(n.attributes[e]))}),void i.trigger("data",n);if((t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"preload-hint"}).attributes=sr(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(e){if(n.attributes.hasOwnProperty(e)){n.attributes[e]=parseInt(n.attributes[e],10);var t="BYTERANGE-LENGTH"===e?"length":"offset";n.attributes.byterange=n.attributes.byterange||{},n.attributes.byterange[t]=n.attributes[e],delete n.attributes[e]}}),void i.trigger("data",n);if((t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e))&&t[1])return(n={type:"tag",tagType:"rendition-report"}).attributes=sr(t[1]),["LAST-MSN","LAST-PART"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=parseInt(n.attributes[e],10))}),void i.trigger("data",n);if((t=/^#EXT-X-DATERANGE:(.*)$/.exec(e))&&t[1]){(n={type:"tag",tagType:"daterange"}).attributes=sr(t[1]),["ID","CLASS"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=String(n.attributes[e]))}),["START-DATE","END-DATE"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=new Date(n.attributes[e]))}),["DURATION","PLANNED-DURATION"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=parseFloat(n.attributes[e]))}),["END-ON-NEXT"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=/YES/i.test(n.attributes[e]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(e){n.attributes.hasOwnProperty(e)&&(n.attributes[e]=n.attributes[e].toString(16))});var s=/^X-([A-Z]+-)+[A-Z]+$/;for(var o in n.attributes)if(s.test(o)){var u=/[0-9A-Fa-f]{6}/g.test(n.attributes[o]),l=/^\d+(\.\d+)?$/.test(n.attributes[o]);n.attributes[o]=u?n.attributes[o].toString(16):l?parseFloat(n.attributes[o]):String(n.attributes[o])}i.trigger("data",n)}else if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(e))i.trigger("data",{type:"tag",tagType:"independent-segments"});else if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(e))i.trigger("data",{type:"tag",tagType:"i-frames-only"});else{if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(e))return(n={type:"tag",tagType:"content-steering"}).attributes=sr(t[1]),void i.trigger("data",n);if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(e))return(n={type:"tag",tagType:"i-frame-playlist"}).attributes=sr(t[1]),n.attributes.URI&&(n.uri=n.attributes.URI),n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes.RESOLUTION&&(n.attributes.RESOLUTION=or(n.attributes.RESOLUTION)),n.attributes["AVERAGE-BANDWIDTH"]&&(n.attributes["AVERAGE-BANDWIDTH"]=parseInt(n.attributes["AVERAGE-BANDWIDTH"],10)),n.attributes["FRAME-RATE"]&&(n.attributes["FRAME-RATE"]=parseFloat(n.attributes["FRAME-RATE"])),void i.trigger("data",n);if(t=/^#EXT-X-DEFINE:(.*)$/.exec(e))return(n={type:"tag",tagType:"define"}).attributes=sr(t[1]),void i.trigger("data",n);i.trigger("data",{type:"tag",data:e.slice(4)})}}}}else i.trigger("data",{type:"comment",text:e.slice(1)})}):this.trigger("data",{type:"uri",uri:e}))}},{key:"addParser",value:function(e){var t=this,n=e.expression,i=e.customType,r=e.dataParser,a=e.segment;"function"!=typeof r&&(r=function(e){return e}),this.customParsers.push(function(e){if(n.exec(e))return t.trigger("data",{type:"custom",data:r(e),customType:i,segment:a}),!0})}},{key:"addTagMapper",value:function(e){var t=e.expression,n=e.map;this.tagMappers.push(function(e){return t.test(e)?n(e):e})}}])}(),lr=function(e){var t={};return Object.keys(e).forEach(function(n){var i;t[(i=n,i.toLowerCase().replace(/-(\w)/g,function(e){return e[1].toUpperCase()}))]=e[n]}),t},cr=function(e){var t=e.serverControl,n=e.targetDuration,i=e.partTargetDuration;if(t){var r="#EXT-X-SERVER-CONTROL",a="holdBack",s="partHoldBack",o=n&&3*n,u=i&&2*i;n&&!t.hasOwnProperty(a)&&(t[a]=o,this.trigger("info",{message:"".concat(r," defaulting HOLD-BACK to targetDuration * 3 (").concat(o,").")})),o&&t[a]<o&&(this.trigger("warn",{message:"".concat(r," clamping HOLD-BACK (").concat(t[a],") to targetDuration * 3 (").concat(o,")")}),t[a]=o),i&&!t.hasOwnProperty(s)&&(t[s]=3*i,this.trigger("info",{message:"".concat(r," defaulting PART-HOLD-BACK to partTargetDuration * 3 (").concat(t[s],").")})),i&&t[s]<u&&(this.trigger("warn",{message:"".concat(r," clamping PART-HOLD-BACK (").concat(t[s],") to partTargetDuration * 2 (").concat(u,").")}),t[s]=u)}},dr=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,e),(t=c(this,e)).lineStream=new ir,t.parseStream=new ur,t.lineStream.pipe(t.parseStream),t.mainDefinitions=n.mainDefinitions||{},t.params=new URL(n.uri,"https://a.com").searchParams,t.lastProgramDateTime=null;var i,r,a=t,s=[],o={},u=!1,l=function(){},d={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},h=0;t.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};var p=0,f=0,m={};return t.on("end",function(){o.uri||!o.parts&&!o.preloadHints||(!o.map&&i&&(o.map=i),!o.key&&r&&(o.key=r),o.timeline||"number"!=typeof h||(o.timeline=h),t.manifest.preloadSegment=o)}),t.parseStream.on("data",function(e){var t,n;if(a.manifest.definitions)for(var c in a.manifest.definitions)if(e.uri&&(e.uri=e.uri.replace("{$".concat(c,"}"),a.manifest.definitions[c])),e.attributes)for(var g in e.attributes)"string"==typeof e.attributes[g]&&(e.attributes[g]=e.attributes[g].replace("{$".concat(c,"}"),a.manifest.definitions[c]));({tag:function(){({version:function(){e.version&&(this.manifest.version=e.version)},"allow-cache":function(){this.manifest.allowCache=e.allowed,"allowed"in e||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var t={};"length"in e&&(o.byterange=t,t.length=e.length,"offset"in e||(e.offset=p)),"offset"in e&&(o.byterange=t,t.offset=e.offset),p=t.offset+t.length},endlist:function(){this.manifest.endList=!0},inf:function(){"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"})),e.title&&(o.title=e.title),e.duration>0&&(o.duration=e.duration),0===e.duration&&(o.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=s},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("com.apple.streamingkeydelivery"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes});if("com.microsoft.playready"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:e.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:er(e.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),r={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},void 0!==e.attributes.IV&&(r.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else r=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,h=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange),r&&(i.key=r)},"stream-inf":function(){this.manifest.playlists=s,this.manifest.mediaGroups=this.manifest.mediaGroups||d,e.attributes?(o.attributes||(o.attributes={}),$(o.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||d,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(n={default:/yes/i.test(e.attributes.DEFAULT)}).default?n.autoselect=!0:n.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(n.language=e.attributes.LANGUAGE),e.attributes.URI&&(n.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(n.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(n.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(n.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=n}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){h+=1,o.discontinuity=!0,this.manifest.discontinuityStarts.push(s.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),o.dateTimeString=e.dateTimeString,o.dateTimeObject=e.dateTimeObject;var t=this.lastProgramDateTime;this.lastProgramDateTime=new Date(e.dateTimeString).getTime(),null===t&&this.manifest.segments.reduceRight(function(e,t){return t.programDateTime=e-1e3*t.duration,t.programDateTime},this.lastProgramDateTime)},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,cr.call(this,this.manifest))},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){o.cueOut=e.data},"cue-out-cont":function(){o.cueOutCont=e.data},"cue-in":function(){o.cueIn=e.data},skip:function(){this.manifest.skip=lr(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part:function(){var t=this;u=!0;var n=this.manifest.segments.length,i=lr(e.attributes);o.parts=o.parts||[],o.parts.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=f),f=i.byterange.offset+i.byterange.length);var r=o.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #".concat(r," for segment #").concat(n),e.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(function(e,n){e.hasOwnProperty("lastPart")||t.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #".concat(n," lacks required attribute(s): LAST-PART")})})},"server-control":function(){var t=this.manifest.serverControl=lr(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),cr.call(this,this.manifest),t.canSkipDateranges&&!t.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":function(){var t=this.manifest.segments.length,n=lr(e.attributes),i=n.type&&"PART"===n.type;o.preloadHints=o.preloadHints||[],o.preloadHints.push(n),n.byterange&&(n.byterange.hasOwnProperty("offset")||(n.byterange.offset=i?f:0,i&&(f=n.byterange.offset+n.byterange.length)));var r=o.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #".concat(r," for segment #").concat(t),e.attributes,["TYPE","URI"]),n.type)for(var a=0;a<o.preloadHints.length-1;a++){var s=o.preloadHints[a];s.type&&(s.type===n.type&&this.trigger("warn",{message:"#EXT-X-PRELOAD-HINT #".concat(r," for segment #").concat(t," has the same TYPE ").concat(n.type," as preload hint #").concat(a)}))}},"rendition-report":function(){var t=lr(e.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(t);var n=this.manifest.renditionReports.length-1,i=["LAST-MSN","URI"];u&&i.push("LAST-PART"),this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #".concat(n),e.attributes,i)},"part-inf":function(){this.manifest.partInf=lr(e.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",e.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),cr.call(this,this.manifest)},daterange:function(){this.manifest.dateRanges.push(lr(e.attributes));var t=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_("#EXT-X-DATERANGE #".concat(t),e.attributes,["ID","START-DATE"]);var n=this.manifest.dateRanges[t];n.endDate&&n.startDate&&new Date(n.endDate)<new Date(n.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),n.duration&&n.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),n.plannedDuration&&n.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});var i=!!n.endOnNext;if(i&&!n.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),i&&(n.duration||n.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),n.duration&&n.endDate){var r=n.startDate.getTime()+1e3*n.duration;this.manifest.dateRanges[t].endDate=new Date(r)}if(m[n.id]){for(var a in m[n.id])if(n[a]&&JSON.stringify(m[n.id][a])!==JSON.stringify(n[a])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}var s=this.manifest.dateRanges.findIndex(function(e){return e.id===n.id});this.manifest.dateRanges[s]=$(this.manifest.dateRanges[s],n),m[n.id]=$(m[n.id],n),this.manifest.dateRanges.pop()}else m[n.id]=n},"independent-segments":function(){this.manifest.independentSegments=!0},"i-frames-only":function(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering":function(){this.manifest.contentSteering=lr(e.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",e.attributes,["SERVER-URI"])},define:function(){var t=this;this.manifest.definitions=this.manifest.definitions||{};var n=function(e,n){e in t.manifest.definitions?t.trigger("error",{message:"EXT-X-DEFINE: Duplicate name ".concat(e)}):t.manifest.definitions[e]=n};if("QUERYPARAM"in e.attributes){if("NAME"in e.attributes||"IMPORT"in e.attributes)return void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});var i=this.params.get(e.attributes.QUERYPARAM);return i?void n(e.attributes.QUERYPARAM,decodeURIComponent(i)):void this.trigger("error",{message:"EXT-X-DEFINE: No query param ".concat(e.attributes.QUERYPARAM)})}return"NAME"in e.attributes?"IMPORT"in e.attributes?void this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"}):"VALUE"in e.attributes&&"string"==typeof e.attributes.VALUE?void n(e.attributes.NAME,e.attributes.VALUE):void this.trigger("error",{message:"EXT-X-DEFINE: No value for ".concat(e.attributes.NAME)}):"IMPORT"in e.attributes?this.mainDefinitions[e.attributes.IMPORT]?void n(e.attributes.IMPORT,this.mainDefinitions[e.attributes.IMPORT]):void this.trigger("error",{message:"EXT-X-DEFINE: No value ".concat(e.attributes.IMPORT," to import, or IMPORT used on main playlist")}):void this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist":function(){this.manifest.iFramePlaylists.push({attributes:e.attributes,uri:e.uri,timeline:h}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",e.attributes,["BANDWIDTH","URI"])}}[e.tagType]||l).call(a)},uri:function(){o.uri=e.uri,s.push(o),this.manifest.targetDuration&&!("duration"in o)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),o.duration=this.manifest.targetDuration),r&&(o.key=r),o.timeline=h,i&&(o.map=i),f=0,null!==this.lastProgramDateTime&&(o.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=1e3*o.duration),o={}},comment:function(){},custom:function(){e.segment?(o.custom=o.custom||{},o.custom[e.customType]=e.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[e.customType]=e.data)}})[e.type].call(a)}),t}return f(e,qi),y(e,[{key:"requiredCompatibilityversion",value:function(e,t){(e<t||!e)&&this.trigger("warn",{message:"manifest must be at least version ".concat(t)})}},{key:"warnOnMissingAttributes_",value:function(e,t,n){var i=[];n.forEach(function(e){t.hasOwnProperty(e)||i.push(e)}),i.length&&this.trigger("warn",{message:"".concat(e," lacks required attribute(s): ").concat(i.join(", "))})}},{key:"push",value:function(e){this.lineStream.push(e)}},{key:"end",value:function(){this.lineStream.push("\n"),this.manifest.dateRanges.length&&null===this.lastProgramDateTime&&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")}},{key:"addParser",value:function(e){this.parseStream.addParser(e)}},{key:"addTagMapper",value:function(e){this.parseStream.addTagMapper(e)}}])}(),hr={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^/},pr=["video","audio","text"],fr=["Video","Audio","Text"],mr=function(e){return e?e.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,n){return"avc1."+("00"+Number(t).toString(16)).slice(-2)+"00"+("00"+Number(n).toString(16)).slice(-2)}):e},gr=function(e){void 0===e&&(e="");var t=e.split(","),n=[];return t.forEach(function(e){var t;e=e.trim(),pr.forEach(function(i){var r=hr[i].exec(e.toLowerCase());if(r&&!(r.length<=1)){t=i;var a=e.substring(0,r[1].length),s=e.replace(a,"");n.push({type:a,details:s,mediaType:i})}}),t||n.push({type:e,details:"",mediaType:"unknown"})}),n},vr=function(e){return void 0===e&&(e=""),hr.audio.test(e.trim().toLowerCase())},yr=function(e){if(e&&"string"==typeof e){var t,n=e.toLowerCase().split(",").map(function(e){return mr(e.trim())}),i="video";1===n.length&&vr(n[0])?i="audio":1===n.length&&(void 0===(t=n[0])&&(t=""),hr.text.test(t.trim().toLowerCase()))&&(i="application");var r="mp4";return n.every(function(e){return hr.mp4.test(e)})?r="mp4":n.every(function(e){return hr.webm.test(e)})?r="webm":n.every(function(e){return hr.ogg.test(e)})&&(r="ogg"),i+"/"+r+';codecs="'+e+'"'}},_r=function(e,t){return void 0===e&&(e=""),void 0===t&&(t=!1),wn.MediaSource&&wn.MediaSource.isTypeSupported&&wn.MediaSource.isTypeSupported(yr(e))||t&&wn.ManagedMediaSource&&wn.ManagedMediaSource.isTypeSupported&&wn.ManagedMediaSource.isTypeSupported(yr(e))||!1},br=function(e){return void 0===e&&(e=""),e.toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t<fr.length;t++){if(hr["muxer"+fr[t]].test(e))return!0}return!1})},Tr="mp4a.40.2",kr=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Sr=/^application\/dash\+xml/i,wr=function(e){return kr.test(e)?"hls":Sr.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null},Er=function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},Cr=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||Er(e)||e instanceof ArrayBuffer||(e="number"!=typeof e||"number"==typeof e&&e!=e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},Ar=wn.BigInt||Number,Ir=[Ar("0x1"),Ar("0x100"),Ar("0x10000"),Ar("0x1000000"),Ar("0x100000000"),Ar("0x10000000000"),Ar("0x1000000000000"),Ar("0x100000000000000"),Ar("0x10000000000000000")];tr=new Uint16Array([65484]),255===(nr=new Uint8Array(tr.buffer,tr.byteOffset,tr.byteLength))[0]||nr[0];var xr=function(e,t){var n=void 0===t?{}:t,i=n.signed,r=void 0!==i&&i,a=n.le,s=void 0!==a&&a;e=Cr(e);var o=s?"reduce":"reduceRight",u=(e[o]?e[o]:Array.prototype[o]).call(e,function(t,n,i){var r=s?i:Math.abs(i+1-e.length);return t+Ar(n)*Ir[r]},Ar(0));if(r){var l=Ir[e.length]/Ar(2)-Ar(1);(u=Ar(u))>l&&(u-=l,u-=l,u-=Ar(2))}return Number(u)},Lr=function(e,t){var n={}.le,i=void 0!==n&&n;("bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e)&&(e=0),e=Ar(e);for(var r,a=(r=e,Math.ceil(function(e){return e.toString(2).length}(r)/8)),s=new Uint8Array(new ArrayBuffer(a)),o=0;o<a;o++){var u=i?o:Math.abs(o+1-s.length);s[u]=Number(e/Ir[o]&Ar(255)),e<0&&(s[u]=Math.abs(~s[u]),s[u]-=0===o?1:2)}return s},Dr=function(e,t){if("string"!=typeof e&&e&&"function"==typeof e.toString&&(e=e.toString()),"string"!=typeof e)return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var n=new Uint8Array(e.length),i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return n},Pr=function(e,t,n){var i=void 0===n?{}:n,r=i.offset,a=void 0===r?0:r,s=i.mask,o=void 0===s?[]:s;e=Cr(e);var u=(t=Cr(t)).every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&u.call(t,function(t,n){return t===(o[n]?o[n]&e[a+n]:e[a+n])})},Rr={},Or={};function Nr(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}var Ur=Nr({HTML:"text/html",isHTML:function(e){return e===Ur.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Mr=Nr({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Mr.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Or.assign=function(e,t){if(null===e||"object"!==k(e))throw new TypeError("target is not an object");for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Or.find=function(e,t,n){if(void 0===n&&(n=Array.prototype),e&&"function"==typeof n.find)return n.find.call(e,t);for(var i=0;i<e.length;i++)if(Object.prototype.hasOwnProperty.call(e,i)){var r=e[i];if(t.call(void 0,r,i,e))return r}},Or.freeze=Nr,Or.MIME_TYPE=Ur,Or.NAMESPACE=Mr;var Br=Or,jr=Br.find,Fr=Br.NAMESPACE;function qr(e){return""!==e}function Vr(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function Hr(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(qr):[]}(e);return Object.keys(t.reduce(Vr,{}))}function zr(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}function Wr(e,t){var n=e.prototype;if(!(n instanceof t)){var i=function(){};i.prototype=t.prototype,zr(n,i=new i),e.prototype=n=i}n.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),n.constructor=e)}var Gr={},Xr=Gr.ELEMENT_NODE=1,Kr=Gr.ATTRIBUTE_NODE=2,Yr=Gr.TEXT_NODE=3,Qr=Gr.CDATA_SECTION_NODE=4,$r=Gr.ENTITY_REFERENCE_NODE=5,Jr=Gr.ENTITY_NODE=6,Zr=Gr.PROCESSING_INSTRUCTION_NODE=7,ea=Gr.COMMENT_NODE=8,ta=Gr.DOCUMENT_NODE=9,na=Gr.DOCUMENT_TYPE_NODE=10,ia=Gr.DOCUMENT_FRAGMENT_NODE=11,ra=Gr.NOTATION_NODE=12,aa={},sa={};aa.INDEX_SIZE_ERR=(sa[1]="Index size error",1),aa.DOMSTRING_SIZE_ERR=(sa[2]="DOMString size error",2);var oa=aa.HIERARCHY_REQUEST_ERR=(sa[3]="Hierarchy request error",3);aa.WRONG_DOCUMENT_ERR=(sa[4]="Wrong document",4),aa.INVALID_CHARACTER_ERR=(sa[5]="Invalid character",5),aa.NO_DATA_ALLOWED_ERR=(sa[6]="No data allowed",6),aa.NO_MODIFICATION_ALLOWED_ERR=(sa[7]="No modification allowed",7);var ua=aa.NOT_FOUND_ERR=(sa[8]="Not found",8);aa.NOT_SUPPORTED_ERR=(sa[9]="Not supported",9);var la=aa.INUSE_ATTRIBUTE_ERR=(sa[10]="Attribute in use",10);function ca(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,sa[e]),this.message=sa[e],Error.captureStackTrace&&Error.captureStackTrace(this,ca);return n.code=e,t&&(this.message=this.message+": "+t),n}function da(){}function ha(e,t){this._node=e,this._refresh=t,pa(this)}function pa(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var n=e._refresh(e._node);if(ts(e,"length",n.length),!e.$$length||n.length<e.$$length)for(var i=n.length;i in e;i++)Object.prototype.hasOwnProperty.call(e,i)&&delete e[i];zr(n,e),e._inc=t}}function fa(){}function ma(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function ga(e,t,n,i){if(i?t[ma(t,i)]=n:t[t.length++]=n,e){n.ownerElement=e;var r=e.ownerDocument;r&&(i&&Sa(r,e,i),function(e,t,n){e&&e._inc++;var i=n.namespaceURI;i===Fr.XMLNS&&(t._nsMap[n.prefix?n.localName:""]=n.value)}(r,e,n))}}function va(e,t,n){var i=ma(t,n);if(!(i>=0))throw new ca(ua,new Error(e.tagName+"@"+n));for(var r=t.length-1;i<r;)t[i]=t[++i];if(t.length=r,e){var a=e.ownerDocument;a&&(Sa(a,e,n),n.ownerElement=null)}}function ya(){}function _a(){}function ba(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function Ta(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(Ta(e,t))return!0}while(e=e.nextSibling)}function ka(){this.ownerDocument=this}function Sa(e,t,n,i){e&&e._inc++,n.namespaceURI===Fr.XMLNS&&delete t._nsMap[n.prefix?n.localName:""]}function wa(e,t,n){if(e&&e._inc){e._inc++;var i=t.childNodes;if(n)i[i.length++]=n;else{for(var r=t.firstChild,a=0;r;)i[a++]=r,r=r.nextSibling;i.length=a,delete i[i.length]}}}function Ea(e,t){var n=t.previousSibling,i=t.nextSibling;return n?n.nextSibling=i:e.firstChild=i,i?i.previousSibling=n:e.lastChild=n,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,wa(e.ownerDocument,e),t}function Ca(e){return e&&e.nodeType===_a.DOCUMENT_TYPE_NODE}function Aa(e){return e&&e.nodeType===_a.ELEMENT_NODE}function Ia(e){return e&&e.nodeType===_a.TEXT_NODE}function xa(e,t){var n=e.childNodes||[];if(jr(n,Aa)||Ca(t))return!1;var i=jr(n,Ca);return!(t&&i&&n.indexOf(i)>n.indexOf(t))}function La(e,t){var n=e.childNodes||[];if(jr(n,function(e){return Aa(e)&&e!==t}))return!1;var i=jr(n,Ca);return!(t&&i&&n.indexOf(i)>n.indexOf(t))}function Da(e,t,n){if(!function(e){return e&&(e.nodeType===_a.DOCUMENT_NODE||e.nodeType===_a.DOCUMENT_FRAGMENT_NODE||e.nodeType===_a.ELEMENT_NODE)}(e))throw new ca(oa,"Unexpected parent node type "+e.nodeType);if(n&&n.parentNode!==e)throw new ca(ua,"child not in parent");if(!function(e){return e&&(Aa(e)||Ia(e)||Ca(e)||e.nodeType===_a.DOCUMENT_FRAGMENT_NODE||e.nodeType===_a.COMMENT_NODE||e.nodeType===_a.PROCESSING_INSTRUCTION_NODE)}(t)||Ca(t)&&e.nodeType!==_a.DOCUMENT_NODE)throw new ca(oa,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Pa(e,t,n){var i=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===_a.DOCUMENT_FRAGMENT_NODE){var a=r.filter(Aa);if(a.length>1||jr(r,Ia))throw new ca(oa,"More than one element or text in fragment");if(1===a.length&&!xa(e,n))throw new ca(oa,"Element in fragment can not be inserted before doctype")}if(Aa(t)&&!xa(e,n))throw new ca(oa,"Only one element can be added and only after doctype");if(Ca(t)){if(jr(i,Ca))throw new ca(oa,"Only one doctype is allowed");var s=jr(i,Aa);if(n&&i.indexOf(s)<i.indexOf(n))throw new ca(oa,"Doctype can only be inserted before an element");if(!n&&s)throw new ca(oa,"Doctype can not be appended since element is present")}}function Ra(e,t,n){var i=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===_a.DOCUMENT_FRAGMENT_NODE){var a=r.filter(Aa);if(a.length>1||jr(r,Ia))throw new ca(oa,"More than one element or text in fragment");if(1===a.length&&!La(e,n))throw new ca(oa,"Element in fragment can not be inserted before doctype")}if(Aa(t)&&!La(e,n))throw new ca(oa,"Only one element can be added and only after doctype");if(Ca(t)){if(jr(i,function(e){return Ca(e)&&e!==n}))throw new ca(oa,"Only one doctype is allowed");var s=jr(i,Aa);if(n&&i.indexOf(s)<i.indexOf(n))throw new ca(oa,"Doctype can only be inserted before an element")}}function Oa(e,t,n,i){Da(e,t,n),e.nodeType===_a.DOCUMENT_NODE&&(i||Pa)(e,t,n);var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===ia){var a=t.firstChild;if(null==a)return t;var s=t.lastChild}else a=s=t;var o=n?n.previousSibling:e.lastChild;a.previousSibling=o,s.nextSibling=n,o?o.nextSibling=a:e.firstChild=a,null==n?e.lastChild=s:n.previousSibling=s;do{a.parentNode=e,Na(a,e.ownerDocument||e)}while(a!==s&&(a=a.nextSibling));return wa(e.ownerDocument||e,e),t.nodeType==ia&&(t.firstChild=t.lastChild=null),t}function Na(e,t){if(e.ownerDocument!==t){if(e.ownerDocument=t,e.nodeType===Xr&&e.attributes)for(var n=0;n<e.attributes.length;n++){var i=e.attributes.item(n);i&&(i.ownerDocument=t)}for(var r=e.firstChild;r;)Na(r,t),r=r.nextSibling}}function Ua(){this._nsMap={}}function Ma(){}function Ba(){}function ja(){}function Fa(){}function qa(){}function Va(){}function Ha(){}function za(){}function Wa(){}function Ga(){}function Xa(){}function Ka(){}function Ya(e,t){var n=[],i=9==this.nodeType&&this.documentElement||this,r=i.prefix,a=i.namespaceURI;if(a&&null==r&&null==(r=i.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return Ja(this,n,e,t,s),n.join("")}function Qa(e,t,n){var i=e.prefix||"",r=e.namespaceURI;if(!r)return!1;if("xml"===i&&r===Fr.XML||r===Fr.XMLNS)return!1;for(var a=n.length;a--;){var s=n[a];if(s.prefix===i)return s.namespace!==r}return!0}function $a(e,t,n){e.push(" ",t,'="',n.replace(/[<>&"\t\n\r]/g,ba),'"')}function Ja(e,t,n,i,r){if(r||(r=[]),i){if(!(e=i(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case Xr:var a=e.attributes,s=a.length,o=e.firstChild,u=e.tagName,l=u;if(!(n=Fr.isHTML(e.namespaceURI)||n)&&!e.prefix&&e.namespaceURI){for(var c,d=0;d<a.length;d++)if("xmlns"===a.item(d).name){c=a.item(d).value;break}if(!c)for(var h=r.length-1;h>=0;h--){if(""===(p=r[h]).prefix&&p.namespace===e.namespaceURI){c=p.namespace;break}}if(c!==e.namespaceURI)for(h=r.length-1;h>=0;h--){var p;if((p=r[h]).namespace===e.namespaceURI){p.prefix&&(l=p.prefix+":"+u);break}}}t.push("<",l);for(var f=0;f<s;f++){"xmlns"==(m=a.item(f)).prefix?r.push({prefix:m.localName,namespace:m.value}):"xmlns"==m.nodeName&&r.push({prefix:"",namespace:m.value})}for(f=0;f<s;f++){var m,g,v;if(Qa(m=a.item(f),0,r))$a(t,(g=m.prefix||"")?"xmlns:"+g:"xmlns",v=m.namespaceURI),r.push({prefix:g,namespace:v});Ja(m,t,n,i,r)}if(u===l&&Qa(e,0,r))$a(t,(g=e.prefix||"")?"xmlns:"+g:"xmlns",v=e.namespaceURI),r.push({prefix:g,namespace:v});if(o||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(t.push(">"),n&&/^script$/i.test(u))for(;o;)o.data?t.push(o.data):Ja(o,t,n,i,r.slice()),o=o.nextSibling;else for(;o;)Ja(o,t,n,i,r.slice()),o=o.nextSibling;t.push("</",l,">")}else t.push("/>");return;case ta:case ia:for(o=e.firstChild;o;)Ja(o,t,n,i,r.slice()),o=o.nextSibling;return;case Kr:return $a(t,e.name,e.value);case Yr:return t.push(e.data.replace(/[<&>]/g,ba));case Qr:return t.push("<![CDATA[",e.data,"]]>");case ea:return t.push("\x3c!--",e.data,"--\x3e");case na:var y=e.publicId,_=e.systemId;if(t.push("<!DOCTYPE ",e.name),y)t.push(" PUBLIC ",y),_&&"."!=_&&t.push(" ",_),t.push(">");else if(_&&"."!=_)t.push(" SYSTEM ",_,">");else{var b=e.internalSubset;b&&t.push(" [",b,"]"),t.push(">")}return;case Zr:return t.push("<?",e.target," ",e.data,"?>");case $r:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Za(e,t,n){var i;switch(t.nodeType){case Xr:(i=t.cloneNode(!1)).ownerDocument=e;case ia:break;case Kr:n=!0}if(i||(i=t.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,n)for(var r=t.firstChild;r;)i.appendChild(Za(e,r,n)),r=r.nextSibling;return i}function es(e,t,n){var i=new t.constructor;for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var a=t[r];"object"!=k(a)&&a!=i[r]&&(i[r]=a)}switch(t.childNodes&&(i.childNodes=new da),i.ownerDocument=e,i.nodeType){case Xr:var s=t.attributes,o=i.attributes=new fa,u=s.length;o._ownerElement=i;for(var l=0;l<u;l++)i.setAttributeNode(es(e,s.item(l),!0));break;case Kr:n=!0}if(n)for(var c=t.firstChild;c;)i.appendChild(es(e,c,n)),c=c.nextSibling;return i}function ts(e,t,n){e[t]=n}aa.INVALID_STATE_ERR=(sa[11]="Invalid state",11),aa.SYNTAX_ERR=(sa[12]="Syntax error",12),aa.INVALID_MODIFICATION_ERR=(sa[13]="Invalid modification",13),aa.NAMESPACE_ERR=(sa[14]="Invalid namespace",14),aa.INVALID_ACCESS_ERR=(sa[15]="Invalid access",15),ca.prototype=Error.prototype,zr(aa,ca),da.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t){for(var n=[],i=0;i<this.length;i++)Ja(this[i],n,e,t);return n.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},ha.prototype.item=function(e){return pa(this),this[e]||null},Wr(ha,da),fa.prototype={length:0,item:da.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var n=this[t];if(n.nodeName==e)return n}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new ca(la);var n=this.getNamedItem(e.nodeName);return ga(this._ownerElement,this,e,n),n},setNamedItemNS:function(e){var t,n=e.ownerElement;if(n&&n!=this._ownerElement)throw new ca(la);return t=this.getNamedItemNS(e.namespaceURI,e.localName),ga(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return va(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);return va(this._ownerElement,this,n),n},getNamedItemNS:function(e,t){for(var n=this.length;n--;){var i=this[n];if(i.localName==t&&i.namespaceURI==e)return i}return null}},ya.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,n){var i=new ka;if(i.implementation=this,i.childNodes=new da,i.doctype=n||null,n&&i.appendChild(n),t){var r=i.createElementNS(e,t);i.appendChild(r)}return i},createDocumentType:function(e,t,n){var i=new Va;return i.name=e,i.nodeName=e,i.publicId=t||"",i.systemId=n||"",i}},_a.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(e,t){return Oa(this,e,t)},replaceChild:function(e,t){Oa(this,e,t,Ra),t&&this.removeChild(t)},removeChild:function(e){return Ea(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return es(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==Yr&&e.nodeType==Yr?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&n[i]===e)return i;t=t.nodeType==Kr?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&Object.prototype.hasOwnProperty.call(n,e))return n[e];t=t.nodeType==Kr?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},zr(Gr,_a),zr(Gr,_a.prototype),ka.prototype={nodeName:"#document",nodeType:ta,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==ia){for(var n=e.firstChild;n;){var i=n.nextSibling;this.insertBefore(n,t),n=i}return e}return Oa(this,e,t),Na(e,this),null===this.documentElement&&e.nodeType===Xr&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),Ea(this,e)},replaceChild:function(e,t){Oa(this,e,t,Ra),Na(e,this),t&&this.removeChild(t),Aa(e)&&(this.documentElement=e)},importNode:function(e,t){return Za(this,e,t)},getElementById:function(e){var t=null;return Ta(this.documentElement,function(n){if(n.nodeType==Xr&&n.getAttribute("id")==e)return t=n,!0}),t},getElementsByClassName:function(e){var t=Hr(e);return new ha(this,function(n){var i=[];return t.length>0&&Ta(n.documentElement,function(r){if(r!==n&&r.nodeType===Xr){var a=r.getAttribute("class");if(a){var s=e===a;if(!s){var o=Hr(a);s=t.every((u=o,function(e){return u&&-1!==u.indexOf(e)}))}s&&i.push(r)}}var u}),i})},createElement:function(e){var t=new Ua;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new da,(t.attributes=new fa)._ownerElement=t,t},createDocumentFragment:function(){var e=new Ga;return e.ownerDocument=this,e.childNodes=new da,e},createTextNode:function(e){var t=new ja;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new Fa;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new qa;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new Xa;return n.ownerDocument=this,n.tagName=n.nodeName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new Ma;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Wa;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new Ua,i=t.split(":"),r=n.attributes=new fa;return n.childNodes=new da,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==i.length?(n.prefix=i[0],n.localName=i[1]):n.localName=t,r._ownerElement=n,n},createAttributeNS:function(e,t){var n=new Ma,i=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==i.length?(n.prefix=i[0],n.localName=i[1]):n.localName=t,n}},Wr(ka,_a),Ua.prototype={nodeType:Xr,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===ia?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,wa(e.ownerDocument,e,t),Na(t,e.ownerDocument||e),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var i=this.ownerDocument.createAttributeNS(e,t);i.value=i.nodeValue=""+n,this.setAttributeNode(i)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new ha(this,function(t){var n=[];return Ta(t,function(i){i===t||i.nodeType!=Xr||"*"!==e&&i.tagName!=e||n.push(i)}),n})},getElementsByTagNameNS:function(e,t){return new ha(this,function(n){var i=[];return Ta(n,function(r){r===n||r.nodeType!==Xr||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||i.push(r)}),i})}},ka.prototype.getElementsByTagName=Ua.prototype.getElementsByTagName,ka.prototype.getElementsByTagNameNS=Ua.prototype.getElementsByTagNameNS,Wr(Ua,_a),Ma.prototype.nodeType=Kr,Wr(Ma,_a),Ba.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(sa[oa])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},Wr(Ba,_a),ja.prototype={nodeName:"#text",nodeType:Yr,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var i=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},Wr(ja,Ba),Fa.prototype={nodeName:"#comment",nodeType:ea},Wr(Fa,Ba),qa.prototype={nodeName:"#cdata-section",nodeType:Qr},Wr(qa,Ba),Va.prototype.nodeType=na,Wr(Va,_a),Ha.prototype.nodeType=ra,Wr(Ha,_a),za.prototype.nodeType=Jr,Wr(za,_a),Wa.prototype.nodeType=$r,Wr(Wa,_a),Ga.prototype.nodeName="#document-fragment",Ga.prototype.nodeType=ia,Wr(Ga,_a),Xa.prototype.nodeType=Zr,Wr(Xa,_a),Ka.prototype.serializeToString=function(e,t,n){return Ya.call(e,t,n)},_a.prototype.toString=Ya;try{if(Object.defineProperty){var ns=function(e){switch(e.nodeType){case Xr:case ia:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(ns(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty(ha.prototype,"length",{get:function(){return pa(this),this.$$length}}),Object.defineProperty(_a.prototype,"textContent",{get:function(){return ns(this)},set:function(e){switch(this.nodeType){case Xr:case ia: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}}}),ts=function(e,t,n){e["$$"+t]=n}}}catch(vy){}Rr.DocumentType=Va,Rr.DOMException=ca,Rr.DOMImplementation=ya,Rr.Element=Ua,Rr.Node=_a,Rr.NodeList=da,Rr.XMLSerializer=Ka;var is,rs,as={},ss={};is=ss,rs=Or.freeze,is.XML_ENTITIES=rs({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),is.HTML_ENTITIES=rs({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:"\n",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:"\t",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:"‌"}),is.entityMap=is.HTML_ENTITIES;var os={},us=Or.NAMESPACE,ls=/[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]/,cs=new RegExp("[\\-\\.0-9"+ls.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),ds=new RegExp("^"+ls.source+cs.source+"*(?::"+ls.source+cs.source+"*)?$");function hs(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,hs)}function ps(){}function fs(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function ms(e,t,n,i,r,a){function s(e,t,i){n.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),n.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),i)}for(var o,u=++t,l=0;;){var c=e.charAt(u);switch(c){case"=":if(1===l)o=e.slice(t,u),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(a.warning('attribute value must after "="'),o=e.slice(t,u)),t=u+1,!((u=e.indexOf(c,t))>0))throw new Error("attribute value no end '"+c+"' match");s(o,d=e.slice(t,u),t-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');s(o,d=e.slice(t,u),t),a.warning('attribute "'+o+'" missed start quot('+c+")!!"),t=u+1,l=5}break;case"/":switch(l){case 0:n.setTagName(e.slice(t,u));case 5:case 6:case 7:l=7,n.closed=!0;case 4:case 1:break;case 2:n.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==l&&n.setTagName(e.slice(t,u)),u;case">":switch(l){case 0:n.setTagName(e.slice(t,u));case 5:case 6:case 7:break;case 4:case 1:"/"===(d=e.slice(t,u)).slice(-1)&&(n.closed=!0,d=d.slice(0,-1));case 2:2===l&&(d=o),4==l?(a.warning('attribute "'+d+'" missed quot(")!'),s(o,d,t)):(us.isHTML(i[""])&&d.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),s(d,d,t));break;case 3:throw new Error("attribute value missed!!")}return u;case"€":c=" ";default:if(c<=" ")switch(l){case 0:n.setTagName(e.slice(t,u)),l=6;break;case 1:o=e.slice(t,u),l=2;break;case 4:var d=e.slice(t,u);a.warning('attribute "'+d+'" missed quot(")!!'),s(o,d,t);case 5:l=6}else switch(l){case 2:n.tagName,us.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),s(o,o,t),t=u,l=1;break;case 5:a.warning('attribute space is required"'+o+'"!!');case 6:l=1,t=u;break;case 3:l=4,t=u;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function gs(e,t,n){for(var i=e.tagName,r=null,a=e.length;a--;){var s=e[a],o=s.qName,u=s.value;if((h=o.indexOf(":"))>0)var l=s.prefix=o.slice(0,h),c=o.slice(h+1),d="xmlns"===l&&c;else c=o,l=null,d="xmlns"===o&&"";s.localName=c,!1!==d&&(null==r&&(r={},_s(n,n={})),n[d]=r[d]=u,s.uri=us.XMLNS,t.startPrefixMapping(d,u))}for(a=e.length;a--;){(l=(s=e[a]).prefix)&&("xml"===l&&(s.uri=us.XML),"xmlns"!==l&&(s.uri=n[l||""]))}var h;(h=i.indexOf(":"))>0?(l=e.prefix=i.slice(0,h),c=e.localName=i.slice(h+1)):(l=null,c=e.localName=i);var p=e.uri=n[l||""];if(t.startElement(p,c,i,e),!e.closed)return e.currentNSMap=n,e.localNSMap=r,!0;if(t.endElement(p,c,i),r)for(l in r)Object.prototype.hasOwnProperty.call(r,l)&&t.endPrefixMapping(l)}function vs(e,t,n,i,r){if(/^(?:script|textarea)$/i.test(n)){var a=e.indexOf("</"+n+">",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(n)?(r.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,i),r.characters(s,0,s.length),a)}return t+1}function ys(e,t,n,i){var r=i[n];return null==r&&((r=e.lastIndexOf("</"+n+">"))<t&&(r=e.lastIndexOf("</"+n)),i[n]=r),r<t}function _s(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}function bs(e,t,n,i){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(r=e.indexOf("--\x3e",t+4))>t?(n.comment(e,t+4,r-t-4),r+3):(i.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,r-t-9),n.endCDATA(),r+3}var a=function(e,t){var n,i=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;n=r.exec(e);)if(i.push(n),n[1])return i}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],u=!1,l=!1;s>3&&(/^public$/i.test(a[2][0])?(u=a[3][0],l=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(l=a[3][0]));var c=a[s-1];return n.startDTD(o,u,l),n.endDTD(),c.index+c[0].length}return-1}function Ts(e,t,n){var i=e.indexOf("?>",t);if(i){var r=e.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,n.processingInstruction(r[1],r[2]),i+2):-1}return-1}function ks(){this.attributeNames={}}hs.prototype=new Error,hs.prototype.name=hs.name,ps.prototype={parse:function(e,t,n){var i=this.domBuilder;i.startDocument(),_s(t,t={}),function(e,t,n,i,r){function a(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function s(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(n,t)?n[t]:"#"===t.charAt(0)?a(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function o(t){if(t>m){var n=e.substring(m,t).replace(/&#?\w+;/g,s);h&&u(m),i.characters(n,0,t-m),m=t}}function u(t,n){for(;t>=c&&(n=d.exec(e));)l=n.index,c=l+n[0].length,h.lineNumber++;h.columnNumber=t-l+1}var l=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,h=i.locator,p=[{currentNSMap:t}],f={},m=0;for(;;){try{var g=e.indexOf("<",m);if(g<0){if(!e.substr(m).match(/^\s*$/)){var v=i.doc,y=v.createTextNode(e.substr(m));v.appendChild(y),i.currentElement=y}return}switch(g>m&&o(g),e.charAt(g+1)){case"/":var _=e.indexOf(">",g+3),b=e.substring(g+2,_).replace(/[ \t\n\r]+$/g,""),T=p.pop();_<0?(b=e.substring(g+2).replace(/[\s<].*/,""),r.error("end tag name: "+b+" is not complete:"+T.tagName),_=g+1+b.length):b.match(/\s</)&&(b=b.replace(/[\s<].*/,""),r.error("end tag name: "+b+" maybe not complete"),_=g+1+b.length);var k=T.localNSMap,S=T.tagName==b;if(S||T.tagName&&T.tagName.toLowerCase()==b.toLowerCase()){if(i.endElement(T.uri,T.localName,b),k)for(var w in k)Object.prototype.hasOwnProperty.call(k,w)&&i.endPrefixMapping(w);S||r.fatalError("end tag name: "+b+" is not match the current start tagName:"+T.tagName)}else p.push(T);_++;break;case"?":h&&u(g),_=Ts(e,g,i);break;case"!":h&&u(g),_=bs(e,g,i,r);break;default:h&&u(g);var E=new ks,C=p[p.length-1].currentNSMap,A=(_=ms(e,g,E,C,s,r),E.length);if(!E.closed&&ys(e,_,E.tagName,f)&&(E.closed=!0,n.nbsp||r.warning("unclosed xml attribute")),h&&A){for(var I=fs(h,{}),x=0;x<A;x++){var L=E[x];u(L.offset),L.locator=fs(h,{})}i.locator=I,gs(E,i,C)&&p.push(E),i.locator=h}else gs(E,i,C)&&p.push(E);us.isHTML(E.uri)&&!E.closed?_=vs(e,_,E.tagName,s,i):_++}}catch(vy){if(vy instanceof hs)throw vy;r.error("element parse error: "+vy),_=-1}_>m?m=_:o(Math.max(g,m)+1)}}(e,t,n,i,this.errorHandler),i.endDocument()}},ks.prototype={setTagName:function(e){if(!ds.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,n){if(!ds.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},os.XMLReader=ps,os.ParseError=hs;var Ss=Or,ws=ss,Es=os,Cs=Rr.DOMImplementation,As=Ss.NAMESPACE,Is=Es.ParseError,xs=Es.XMLReader;function Ls(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function Ds(e){this.options=e||{locator:{}}}function Ps(){this.cdata=!1}function Rs(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Os(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function Ns(e,t,n){return"string"==typeof e?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}function Us(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Ds.prototype.parseFromString=function(e,t){var n=this.options,i=new xs,r=n.domBuilder||new Ps,a=n.errorHandler,s=n.locator,o=n.xmlns||{},u=/\/x?html?$/.test(t),l=u?ws.HTML_ENTITIES:ws.XML_ENTITIES;s&&r.setDocumentLocator(s),i.errorHandler=function(e,t,n){if(!e){if(t instanceof Ps)return t;e=t}var i={},r=e instanceof Function;function a(t){var a=e[t];!a&&r&&(a=2==e.length?function(n){e(t,n)}:e),i[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+Os(n))}||function(){}}return n=n||{},a("warning"),a("error"),a("fatalError"),i}(a,r,s),i.domBuilder=n.domBuilder||r,u&&(o[""]=As.HTML),o.xml=o.xml||As.XML;var c=n.normalizeLineEndings||Ls;return e&&"string"==typeof e?i.parse(c(e),o,l):i.errorHandler.error("invalid doc source"),r.doc},Ps.prototype={startDocument:function(){this.doc=(new Cs).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,i){var r=this.doc,a=r.createElementNS(e,n||t),s=i.length;Us(this,a),this.currentElement=a,this.locator&&Rs(this.locator,a);for(var o=0;o<s;o++){e=i.getURI(o);var u=i.getValue(o),l=(n=i.getQName(o),r.createAttributeNS(e,n));this.locator&&Rs(i.getLocator(o),l),l.value=l.nodeValue=u,a.setAttributeNode(l)}},endElement:function(e,t,n){var i=this.currentElement;i.tagName,this.currentElement=i.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&Rs(this.locator,n),Us(this,n)},ignorableWhitespace:function(e,t,n){},characters:function(e,t,n){if(e=Ns.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(e);else i=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(e)&&this.doc.appendChild(i),this.locator&&Rs(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,n){e=Ns.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&Rs(this.locator,i),Us(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,n){var i=this.doc.implementation;if(i&&i.createDocumentType){var r=i.createDocumentType(e,t,n);this.locator&&Rs(this.locator,r),Us(this,r),this.doc.doctype=r}},warning:function(e){console.warn("[xmldom warning]\t"+e,Os(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,Os(this.locator))},fatalError:function(e){throw new Is(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){Ps.prototype[e]=function(){return null}}),as.__DOMHandler=Ps,as.normalizeLineEndings=Ls,as.DOMParser=Ds;var Ms=as.DOMParser,Bs=Object.freeze(Object.defineProperty({__proto__:null,DOMParser:Ms},Symbol.toStringTag,{value:"Module"})),js=function(e){return!!e&&"object"===k(e)},Fs=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(function(e,t){return"object"!==k(t)||Object.keys(t).forEach(function(n){Array.isArray(e[n])&&Array.isArray(t[n])?e[n]=e[n].concat(t[n]):js(e[n])&&js(t[n])?e[n]=Fs(e[n],t[n]):e[n]=t[n]}),e},{})},qs=function(e){return Object.keys(e).map(function(t){return e[t]})},Vs=function(e){return e.reduce(function(e,t){return e.concat(t)},[])},Hs=function(e){if(!e.length)return[];for(var t=[],n=0;n<e.length;n++)t.push(e[n]);return t},zs="INVALID_NUMBER_OF_PERIOD",Ws="DASH_EMPTY_MANIFEST",Gs="DASH_INVALID_XML",Xs="NO_BASE_URL",Ks="SEGMENT_TIME_UNSPECIFIED",Ys="UNSUPPORTED_UTC_TIMING_SCHEME",Qs=function(e){var t=e.baseUrl,n=void 0===t?"":t,i=e.source,r=void 0===i?"":i,a=e.range,s=void 0===a?"":a,o=e.indexRange,u=void 0===o?"":o,l={uri:r,resolvedUri:Fi(n||"",r)};if(s||u){var c,d=(s||u).split("-"),h=wn.BigInt?wn.BigInt(d[0]):parseInt(d[0],10),p=wn.BigInt?wn.BigInt(d[1]):parseInt(d[1],10);h<Number.MAX_SAFE_INTEGER&&"bigint"==typeof h&&(h=Number(h)),p<Number.MAX_SAFE_INTEGER&&"bigint"==typeof p&&(p=Number(p)),"bigint"==typeof(c="bigint"==typeof p||"bigint"==typeof h?wn.BigInt(p)-wn.BigInt(h)+wn.BigInt(1):p-h+1)&&c<Number.MAX_SAFE_INTEGER&&(c=Number(c)),l.byterange={length:c,offset:h}}return l},$s=function(e){return e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e},Js={static:function(e){var t=e.duration,n=e.timescale,i=void 0===n?1:n,r=e.sourceDuration,a=e.periodDuration,s=$s(e.endNumber),o=t/i;return"number"==typeof s?{start:0,end:s}:"number"==typeof a?{start:0,end:a/o}:{start:0,end:r/o}},dynamic:function(e){var t=e.NOW,n=e.clientOffset,i=e.availabilityStartTime,r=e.timescale,a=void 0===r?1:r,s=e.duration,o=e.periodStart,u=void 0===o?0:o,l=e.minimumUpdatePeriod,c=void 0===l?0:l,d=e.timeShiftBufferDepth,h=void 0===d?1/0:d,p=$s(e.endNumber),f=(t+n)/1e3,m=i+u,g=f+c-m,v=Math.ceil(g*a/s),y=Math.floor((f-m-h)*a/s),_=Math.floor((f-m)*a/s);return{start:Math.max(0,y),end:"number"==typeof p?p:Math.min(v,_)}}},Zs=function(e){var t=e.type,n=e.duration,i=e.timescale,r=void 0===i?1:i,a=e.periodDuration,s=e.sourceDuration,o=Js[t](e),u=function(e,t){for(var n=[],i=e;i<t;i++)n.push(i);return n}(o.start,o.end).map(function(e){return function(t){var n=e.duration,i=e.timescale,r=void 0===i?1:i,a=e.periodStart,s=e.startNumber;return{number:(void 0===s?1:s)+t,duration:n/r,timeline:a,time:t*n}}}(e));if("static"===t){var l=u.length-1,c="number"==typeof a?a:s;u[l].duration=c-n/r*l}return u},eo=function(e){var t=e.baseUrl,n=e.initialization,i=void 0===n?{}:n,r=e.sourceDuration,a=e.indexRange,s=void 0===a?"":a,o=e.periodStart,u=e.presentationTime,l=e.number,c=void 0===l?0:l,d=e.duration;if(!t)throw new Error(Xs);var h=Qs({baseUrl:t,source:i.sourceURL,range:i.range}),p=Qs({baseUrl:t,source:t,indexRange:s});if(p.map=h,d){var f=Zs(e);f.length&&(p.duration=f[0].duration,p.timeline=f[0].timeline)}else r&&(p.duration=r,p.timeline=o);return p.presentationTime=u||o,p.number=c,[p]},to=function(e,t,n){var i,r=e.sidx.map?e.sidx.map:null,a=e.sidx.duration,s=e.timeline||0,o=e.sidx.byterange,u=o.offset+o.length,l=t.timescale,c=t.references.filter(function(e){return 1!==e.referenceType}),d=[],h=e.endList?"static":"dynamic",p=e.sidx.timeline,f=p,m=e.mediaSequence||0;i="bigint"==typeof t.firstOffset?wn.BigInt(u)+t.firstOffset:u+t.firstOffset;for(var g=0;g<c.length;g++){var v=t.references[g],y=v.referencedSize,_=v.subsegmentDuration,b=void 0;b="bigint"==typeof i?i+wn.BigInt(y)-wn.BigInt(1):i+y-1;var T="".concat(i,"-").concat(b),k=eo({baseUrl:n,timescale:l,timeline:s,periodStart:p,presentationTime:f,number:m,duration:_,sourceDuration:a,indexRange:T,type:h})[0];r&&(k.map=r),d.push(k),i+="bigint"==typeof i?wn.BigInt(y):y,f+=_/l,m++}return e.segments=d,e},no=["AUDIO","SUBTITLES"],io=1/60,ro=function(e){return(t=e,n=function(e){return e.timeline},qs(t.reduce(function(e,t){return t.forEach(function(t){e[n(t)]=t}),e},{}))).sort(function(e,t){return e.timeline>t.timeline?1:-1});var t,n},ao=function(e){var t,n,i=[];return t=e,n=function(e,t,n,r){i=i.concat(e.playlists||[])},no.forEach(function(e){for(var i in t.mediaGroups[e])for(var r in t.mediaGroups[e][i]){var a=t.mediaGroups[e][i][r];n(a,e,i,r)}}),i},so=function(e){var t=e.playlist,n=e.mediaSequence;t.mediaSequence=n,t.segments.forEach(function(e,n){e.number=t.mediaSequence+n})},oo=function(e){var t=e.oldManifest,n=e.newManifest,i=t.playlists.concat(ao(t)),r=n.playlists.concat(ao(n));return n.timelineStarts=ro([t.timelineStarts,n.timelineStarts]),function(e){var t=e.oldPlaylists,n=e.newPlaylists,i=e.timelineStarts;n.forEach(function(e){e.discontinuitySequence=i.findIndex(function(t){return t.timeline===e.timeline});var n=function(e,t){for(var n=0;n<e.length;n++)if(e[n].attributes.NAME===t)return e[n];return null}(t,e.attributes.NAME);if(n&&!e.sidx){var r=e.segments[0],a=n.segments.findIndex(function(e){return Math.abs(e.presentationTime-r.presentationTime)<io});if(-1===a)return so({playlist:e,mediaSequence:n.mediaSequence+n.segments.length}),e.segments[0].discontinuity=!0,e.discontinuityStarts.unshift(0),void((!n.segments.length&&e.timeline>n.timeline||n.segments.length&&e.timeline>n.segments[n.segments.length-1].timeline)&&e.discontinuitySequence--);n.segments[a].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,e.discontinuityStarts.unshift(0),e.discontinuitySequence--),so({playlist:e,mediaSequence:n.segments[a].number})}})}({oldPlaylists:i,newPlaylists:r,timelineStarts:n.timelineStarts}),n},uo=function(e){return e&&e.uri+"-"+(t=e.byterange,n="bigint"==typeof t.offset||"bigint"==typeof t.length?wn.BigInt(t.offset)+wn.BigInt(t.length)-wn.BigInt(1):t.offset+t.length-1,"".concat(t.offset,"-").concat(n));var t,n},lo=function(e){var t=e.reduce(function(e,t){return e[t.attributes.baseUrl]||(e[t.attributes.baseUrl]=[]),e[t.attributes.baseUrl].push(t),e},{}),n=[];return Object.values(t).forEach(function(e){var t=qs(e.reduce(function(e,t){var n=t.attributes.id+(t.attributes.lang||"");if(e[n]){var i;if(t.segments)t.segments[0]&&(t.segments[0].discontinuity=!0),(i=e[n].segments).push.apply(i,b(t.segments));t.attributes.contentProtection&&(e[n].attributes.contentProtection=t.attributes.contentProtection)}else e[n]=t,e[n].attributes.timelineStarts=[];return e[n].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e},{}));n=n.concat(t)}),n.map(function(e){var t,n;return e.discontinuityStarts=(t=e.segments||[],n="discontinuity",t.reduce(function(e,t,i){return t[n]&&e.push(i),e},[])),e})},co=function(e,t){var n=uo(e.sidx),i=n&&t[n]&&t[n].sidx;return i&&to(e,i,e.sidx.resolvedUri),e},ho=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Object.keys(t).length)return e;for(var n in e)e[n]=co(e[n],t);return e},po=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.reduce(function(e,r){var a=r.attributes.role&&r.attributes.role.value||"",s=r.attributes.lang||"",o=r.attributes.label||"main";if(s&&!r.attributes.label){var u=a?" (".concat(a,")"):"";o="".concat(r.attributes.lang).concat(u)}e[o]||(e[o]={language:s,autoselect:!0,default:"main"===a,playlists:[],uri:""});var l=co(function(e,t){var n=e.attributes,i=e.segments,r=e.sidx,a=e.mediaSequence,s=e.discontinuitySequence,o=e.discontinuityStarts,u={attributes:I({NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},"PROGRAM-ID",1),uri:"",endList:"static"===n.type,timeline:n.periodStart,resolvedUri:n.baseUrl||"",targetDuration:n.duration,discontinuitySequence:s,discontinuityStarts:o,timelineStarts:n.timelineStarts,mediaSequence:a,segments:i};return n.contentProtection&&(u.contentProtection=n.contentProtection),n.serviceLocation&&(u.attributes.serviceLocation=n.serviceLocation),r&&(u.sidx=r),t&&(u.attributes.AUDIO="audio",u.attributes.SUBTITLES="subs"),u}(r,i),n);return e[o].playlists.push(l),void 0===t&&"main"===a&&((t=r).default=!0),e},{});t||(r[Object.keys(r)[0]].default=!0);return r},fo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.reduce(function(e,n){var i=n.attributes.label||n.attributes.lang||"text",r=n.attributes.lang||"und";return e[i]||(e[i]={language:r,default:!1,autoselect:!1,playlists:[],uri:""}),e[i].playlists.push(co(function(e){var t=e.attributes,n=e.segments,i=e.mediaSequence,r=e.discontinuityStarts,a=e.discontinuitySequence;void 0===n&&(n=[{uri:t.baseUrl,timeline:t.periodStart,resolvedUri:t.baseUrl||"",duration:t.sourceDuration,number:0}],t.duration=t.sourceDuration);var s=I({NAME:t.id,BANDWIDTH:t.bandwidth},"PROGRAM-ID",1);t.codecs&&(s.CODECS=t.codecs);var o={attributes:s,uri:"",endList:"static"===t.type,timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,timelineStarts:t.timelineStarts,discontinuityStarts:r,discontinuitySequence:a,mediaSequence:i,segments:n};return t.serviceLocation&&(o.attributes.serviceLocation=t.serviceLocation),o}(n),t)),e},{})},mo=function(e){var t=e.attributes,n=e.segments,i=e.sidx,r=e.discontinuityStarts,a={attributes:I({NAME:t.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:t.width,height:t.height},CODECS:t.codecs,BANDWIDTH:t.bandwidth},"PROGRAM-ID",1),uri:"",endList:"static"===t.type,timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,discontinuityStarts:r,timelineStarts:t.timelineStarts,segments:n};return t.frameRate&&(a.attributes["FRAME-RATE"]=t.frameRate),t.contentProtection&&(a.contentProtection=t.contentProtection),t.serviceLocation&&(a.attributes.serviceLocation=t.serviceLocation),i&&(a.sidx=i),a},go=function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video/webm"===t.mimeType||"video"===t.contentType},vo=function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio/webm"===t.mimeType||"audio"===t.contentType},yo=function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType},_o=function(e){return e?Object.keys(e).reduce(function(t,n){var i=e[n];return t.concat(i.playlists)},[]):[]},bo=function(e,t,n){var i=e.NOW,r=e.clientOffset,a=e.availabilityStartTime,s=e.timescale,o=void 0===s?1:s,u=e.periodStart,l=void 0===u?0:u,c=e.minimumUpdatePeriod,d=(i+r)/1e3+(void 0===c?0:c)-(a+l);return Math.ceil((d*o-t)/n)},To=function(e,t){for(var n=e.type,i=e.minimumUpdatePeriod,r=void 0===i?0:i,a=e.media,s=void 0===a?"":a,o=e.sourceDuration,u=e.timescale,l=void 0===u?1:u,c=e.startNumber,d=void 0===c?1:c,h=e.periodStart,p=[],f=-1,m=0;m<t.length;m++){var g=t[m],v=g.d,y=g.r||0,_=g.t||0;f<0&&(f=_),_&&_>f&&(f=_);var b=void 0;if(y<0){var T=m+1;b=T===t.length?"dynamic"===n&&r>0&&s.indexOf("$Number$")>0?bo(e,f,v):(o*l-f)/v:(t[T].t-f)/v}else b=y+1;for(var k=d+p.length+b,S=d+p.length;S<k;)p.push({number:S,duration:v/l,time:f,timeline:h}),f+=v,S++}return p},ko=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,So=function(e,t){return e.replace(ko,function(e){return function(t,n,i,r){if("$$"===t)return"$";if(void 0===e[n])return t;var a=""+e[n];return"RepresentationID"===n?a:(r=i?parseInt(r,10):1,a.length>=r?a:"".concat(new Array(r-a.length+1).join("0")).concat(a))}}(t))},wo=function(e,t){var n={RepresentationID:e.id,Bandwidth:e.bandwidth||0},i=e.initialization,r=void 0===i?{sourceURL:"",range:""}:i,a=Qs({baseUrl:e.baseUrl,source:So(r.sourceURL,n),range:r.range}),s=function(e,t){return e.duration||t?e.duration?Zs(e):To(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}]}(e,t);return s.map(function(t){n.Number=t.number,n.Time=t.time;var i=So(e.media||"",n),r=e.timescale||1,s=e.presentationTimeOffset||0,o=e.periodStart+(t.time-s)/r;return{uri:i,timeline:t.timeline,duration:t.duration,resolvedUri:Fi(e.baseUrl||"",i),map:a,number:t.number,presentationTime:o}})},Eo=function(e,t){var n=e.duration,i=e.segmentUrls,r=void 0===i?[]:i,a=e.periodStart;if(!n&&!t||n&&t)throw new Error(Ks);var s,o=r.map(function(t){return function(e,t){var n=e.baseUrl,i=e.initialization,r=void 0===i?{}:i,a=Qs({baseUrl:n,source:r.sourceURL,range:r.range}),s=Qs({baseUrl:n,source:t.media,range:t.mediaRange});return s.map=a,s}(e,t)});return n&&(s=Zs(e)),t&&(s=To(e,t)),s.map(function(t,n){if(o[n]){var i=o[n],r=e.timescale||1,s=e.presentationTimeOffset||0;return i.timeline=t.timeline,i.duration=t.duration,i.number=t.number,i.presentationTime=a+(t.time-s)/r,i}}).filter(function(e){return e})},Co=function(e){var t,n,i=e.attributes,r=e.segmentInfo;r.template?(n=wo,t=Fs(i,r.template)):r.base?(n=eo,t=Fs(i,r.base)):r.list&&(n=Eo,t=Fs(i,r.list));var a={attributes:i};if(!n)return a;var s=n(t,r.segmentTimeline);if(t.duration){var o=t,u=o.duration,l=o.timescale,c=void 0===l?1:l;t.duration=u/c}else s.length?t.duration=s.reduce(function(e,t){return Math.max(e,Math.ceil(t.duration))},0):t.duration=0;return a.attributes=t,a.segments=s,r.base&&t.indexRange&&(a.sidx=s[0],a.segments=[]),a},Ao=function(e,t){return Hs(e.childNodes).filter(function(e){return e.tagName===t})},Io=function(e){return e.textContent.trim()},xo=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var n=S(t.slice(1),6),i=n[0],r=n[1],a=n[2],s=n[3],o=n[4],u=n[5];return 31536e3*parseFloat(i||0)+2592e3*parseFloat(r||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(u||0)},Lo={mediaPresentationDuration:function(e){return xo(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return xo(e)},suggestedPresentationDelay:function(e){return xo(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return xo(e)},start:function(e){return xo(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},frameRate:function(e){return function(e){return parseFloat(e.split("/").reduce(function(e,t){return e/t}))}(e)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},presentationTimeOffset:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?xo(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},presentationTime:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},Do=function(e){return e&&e.attributes?Hs(e.attributes).reduce(function(e,t){var n=Lo[t.name]||Lo.DEFAULT;return e[t.name]=n(t.value),e},{}):{}},Po={"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"},Ro=function(e,t){return t.length?Vs(e.map(function(e){return t.map(function(t){var n=Io(t),i=Fi(e.baseUrl,n),r=Fs(Do(t),{baseUrl:i});return i!==n&&!r.serviceLocation&&e.serviceLocation&&(r.serviceLocation=e.serviceLocation),r})})):e},Oo=function(e){var t=Ao(e,"SegmentTemplate")[0],n=Ao(e,"SegmentList")[0],i=n&&Ao(n,"SegmentURL").map(function(e){return Fs({tag:"SegmentURL"},Do(e))}),r=Ao(e,"SegmentBase")[0],a=n||t,s=a&&Ao(a,"SegmentTimeline")[0],o=n||r||t,u=o&&Ao(o,"Initialization")[0],l=t&&Do(t);l&&u?l.initialization=u&&Do(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var c={template:l,segmentTimeline:s&&Ao(s,"S").map(function(e){return Do(e)}),list:n&&Fs(Do(n),{segmentUrls:i,initialization:Do(u)}),base:r&&Fs(Do(r),{initialization:Do(u)})};return Object.keys(c).forEach(function(e){c[e]||delete c[e]}),c},No=function(e){return Vs(Ao(e.node,"EventStream").map(function(t){var n=Do(t),i=n.schemeIdUri;return Ao(t,"Event").map(function(t){var r=Do(t),a=r.presentationTime||0,s=n.timescale||1,o=r.duration||0,u=a/s+e.attributes.start;return{schemeIdUri:i,value:n.value,id:r.id,start:u,end:u+o/s,messageData:Io(t)||r.messageData,contentEncoding:n.contentEncoding,presentationTimeOffset:n.presentationTimeOffset||0}})}))},Uo=function(e,t,n){return function(i){var r,a=Do(i),s=Ro(t,Ao(i,"BaseURL")),o=Ao(i,"Role")[0],u={role:Do(o)},l=Fs(e,a,u),c=Ao(i,"Accessibility")[0],d="urn:scte:dash:cc:cea-608:2015"===(r=Do(c)).schemeIdUri?("string"!=typeof r.value?[]:r.value.split(";")).map(function(e){var t,n;if(n=e,/^CC\d=/.test(e)){var i=S(e.split("="),2);t=i[0],n=i[1]}else/^CC\d$/.test(e)&&(t=e);return{channel:t,language:n}}):"urn:scte:dash:cc:cea-708:2015"===r.schemeIdUri?("string"!=typeof r.value?[]:r.value.split(";")).map(function(e){var t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){var n=S(e.split("="),2),i=n[0],r=n[1],a=void 0===r?"":r;t.channel=i,t.language=e,a.split(",").forEach(function(e){var n=S(e.split(":"),2),i=n[0],r=n[1];"lang"===i?t.language=r:"er"===i?t.easyReader=Number(r):"war"===i?t.aspectRatio=Number(r):"3D"===i&&(t["3D"]=Number(r))})}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t}):void 0;d&&(l=Fs(l,{captionServices:d}));var h=Ao(i,"Label")[0];if(h&&h.childNodes.length){var p=h.childNodes[0].nodeValue.trim();l=Fs(l,{label:p})}var f=Ao(i,"ContentProtection").reduce(function(e,t){var n=Do(t);n.schemeIdUri&&(n.schemeIdUri=n.schemeIdUri.toLowerCase());var i=Po[n.schemeIdUri];if(i){e[i]={attributes:n};var r=Ao(t,"cenc:pssh")[0];if(r){var a=Io(r);e[i].pssh=a&&er(a)}}return e},{});Object.keys(f).length&&(l=Fs(l,{contentProtection:f}));var m=Oo(i),g=Ao(i,"Representation"),v=Fs(n,m);return Vs(g.map(function(e,t,n){return function(i){var r=Ao(i,"BaseURL"),a=Ro(t,r),s=Fs(e,Do(i)),o=Oo(i);return a.map(function(e){return{segmentInfo:Fs(n,o),attributes:Fs(s,e)}})}}(l,s,v)))}},Mo=function(e,t){return function(n,i){var r=Ro(t,Ao(n.node,"BaseURL")),a=Fs(e,{periodStart:n.attributes.start});"number"==typeof n.attributes.duration&&(a.periodDuration=n.attributes.duration);var s=Ao(n.node,"AdaptationSet"),o=Oo(n.node);return Vs(s.map(Uo(a,r,o)))}},Bo=function(e,t){if(e.length>1&&t({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!e.length)return null;var n=Fs({serverURL:Io(e[0])},Do(e[0]));return n.queryBeforeStart="true"===n.queryBeforeStart,n},jo=function(e){if(""===e)throw new Error(Ws);var t,n,i=new Ms;try{n=(t=i.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(vy){}if(!n||n&&n.getElementsByTagName("parsererror").length>0)throw new Error(Gs);return n},Fo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.manifestUri,i=void 0===n?"":n,r=t.NOW,a=void 0===r?Date.now():r,s=t.clientOffset,o=void 0===s?0:s,u=t.eventHandler,l=void 0===u?function(){}:u,c=Ao(e,"Period");if(!c.length)throw new Error(zs);var d=Ao(e,"Location"),h=Do(e),p=Ro([{baseUrl:i}],Ao(e,"BaseURL")),f=Ao(e,"ContentSteering");h.type=h.type||"static",h.sourceDuration=h.mediaPresentationDuration||0,h.NOW=a,h.clientOffset=o,d.length&&(h.locations=d.map(Io));var m=[];return c.forEach(function(e,t){var n=Do(e),i=m[t-1];n.start=function(e){var t=e.attributes,n=e.priorPeriodAttributes,i=e.mpdType;return"number"==typeof t.start?t.start:n&&"number"==typeof n.start&&"number"==typeof n.duration?n.start+n.duration:n||"static"!==i?null:0}({attributes:n,priorPeriodAttributes:i?i.attributes:null,mpdType:h.type}),m.push({node:e,attributes:n})}),{locations:h.locations,contentSteeringInfo:Bo(f,l),representationInfo:Vs(m.map(Mo(h,p))),eventStream:Vs(m.map(No))}}(jo(e),t);return function(e){var t=e.dashPlaylists,n=e.locations,i=e.contentSteering,r=e.sidxMapping,a=void 0===r?{}:r,s=e.previousManifest,o=e.eventStream;if(!t.length)return{};var u=t[0].attributes,l=u.sourceDuration,c=u.type,d=u.suggestedPresentationDelay,h=u.minimumUpdatePeriod,p=lo(t.filter(go)).map(mo),f=lo(t.filter(vo)),m=lo(t.filter(yo)),g=t.map(function(e){return e.attributes.captionServices}).filter(Boolean),v={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:I(I({AUDIO:{},VIDEO:{}},"CLOSED-CAPTIONS",{}),"SUBTITLES",{}),uri:"",duration:l,playlists:ho(p,a)};h>=0&&(v.minimumUpdatePeriod=1e3*h),n&&(v.locations=n),i&&(v.contentSteering=i),"dynamic"===c&&(v.suggestedPresentationDelay=d),o&&o.length>0&&(v.eventStream=o);var y,_,b=0===v.playlists.length,T=f.length?po(f,a,b):null,k=m.length?fo(m,a):null,S=p.concat(_o(T),_o(k)),w=S.map(function(e){return e.timelineStarts});return v.timelineStarts=ro(w),y=S,_=v.timelineStarts,y.forEach(function(e){e.mediaSequence=0,e.discontinuitySequence=_.findIndex(function(t){return t.timeline===e.timeline}),e.segments&&e.segments.forEach(function(e,t){e.number=t})}),T&&(v.mediaGroups.AUDIO.audio=T),k&&(v.mediaGroups.SUBTITLES.subs=k),g.length&&(v.mediaGroups["CLOSED-CAPTIONS"].cc=g.reduce(function(e,t){return t?(t.forEach(function(t){var n=t.channel,i=t.language;e[i]={autoselect:!1,default:!1,instreamId:n,language:i},t.hasOwnProperty("aspectRatio")&&(e[i].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[i].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[i]["3D"]=t["3D"])}),e):e},{})),s?oo({oldManifest:s,newManifest:v}):v}({dashPlaylists:n.representationInfo.map(Co),locations:n.locations,contentSteering:n.contentSteeringInfo,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest,eventStream:n.eventStream})},qo=function(e){return function(e){var t=Ao(e,"UTCTiming")[0];if(!t)return null;var n=Do(t);switch(n.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":n.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":n.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":n.method="DIRECT",n.value=Date.parse(n.value);break;default:throw new Error(Ys)}return n}(jo(e))},Vo=Math.pow(2,32),Ho=function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getBigUint64?(t=n.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:n.getUint32(0)*Vo+n.getUint32(4)},zo=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},i=12;0===n.version?(n.earliestPresentationTime=t.getUint32(i),n.firstOffset=t.getUint32(i+4),i+=8):(n.earliestPresentationTime=Ho(e.subarray(i)),n.firstOffset=Ho(e.subarray(i+8)),i+=16),i+=2;var r=t.getUint16(i);for(i+=2;r>0;i+=12,r--)n.references.push({referenceType:(128&e[i])>>>7,referencedSize:2147483647&t.getUint32(i),subsegmentDuration:t.getUint32(i+4),startsWithSap:!!(128&e[i+8]),sapType:(112&e[i+8])>>>4,sapDeltaTime:268435455&t.getUint32(i+8)});return n},Wo=F.getDefaultExportFromCjs(zo),Go=Cr([73,68,51]),Xo=function e(t,n){return void 0===n&&(n=0),(t=Cr(t)).length-n<10||!Pr(t,Go,{offset:n})?n:(n+=function(e,t){void 0===t&&(t=0);var n=(e=Cr(e))[t+5],i=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&n)>>4?i+20:i+10}(t,n),e(t,n))},Ko=function(e){return"string"==typeof e?Dr(e):e},Yo=function e(t,n,i){void 0===i&&(i=!1),n=function(e){return Array.isArray(e)?e.map(function(e){return Ko(e)}):[Ko(e)]}(n),t=Cr(t);var r=[];if(!n.length)return r;for(var a=0;a<t.length;){var s=(t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3])>>>0,o=t.subarray(a+4,a+8);if(0===s)break;var u=a+s;if(u>t.length){if(i)break;u=t.length}var l=t.subarray(a+8,u);Pr(o,n[0])&&(1===n.length?r.push(l):r.push.apply(r,e(l,n.slice(1),i))),a=u}return r},Qo={EBML:Cr([26,69,223,163]),DocType:Cr([66,130]),Segment:Cr([24,83,128,103]),SegmentInfo:Cr([21,73,169,102]),Tracks:Cr([22,84,174,107]),Track:Cr([174]),TrackNumber:Cr([215]),DefaultDuration:Cr([35,227,131]),TrackEntry:Cr([174]),TrackType:Cr([131]),FlagDefault:Cr([136]),CodecID:Cr([134]),CodecPrivate:Cr([99,162]),VideoTrack:Cr([224]),AudioTrack:Cr([225]),Cluster:Cr([31,67,182,117]),Timestamp:Cr([231]),TimestampScale:Cr([42,215,177]),BlockGroup:Cr([160]),BlockDuration:Cr([155]),Block:Cr([161]),SimpleBlock:Cr([163])},$o=[128,64,32,16,8,4,2,1],Jo=function(e,t,n,i){void 0===n&&(n=!0),void 0===i&&(i=!1);var r=function(e){for(var t=1,n=0;n<$o.length&&!(e&$o[n]);n++)t++;return t}(e[t]),a=e.subarray(t,t+r);return n&&((a=Array.prototype.slice.call(e,t,t+r))[0]^=$o[r-1]),{length:r,value:xr(a,{signed:i}),bytes:a}},Zo=function e(t){return"string"==typeof t?t.match(/.{1,2}/g).map(function(t){return e(t)}):"number"==typeof t?Lr(t):t},eu=function e(t,n,i){if(i>=n.length)return n.length;var r=Jo(n,i,!1);if(Pr(t.bytes,r.bytes))return i;var a=Jo(n,i+r.length);return e(t,n,i+a.length+a.value+r.length)},tu=function e(t,n){n=function(e){return Array.isArray(e)?e.map(function(e){return Zo(e)}):[Zo(e)]}(n),t=Cr(t);var i=[];if(!n.length)return i;for(var r=0;r<t.length;){var a=Jo(t,r,!1),s=Jo(t,r+a.length),o=r+a.length+s.length;127===s.value&&(s.value=eu(a,t,o),s.value!==t.length&&(s.value-=o));var u=o+s.value>t.length?t.length:o+s.value,l=t.subarray(o,u);Pr(n[0],a.bytes)&&(1===n.length?i.push(l):i=i.concat(e(l,n.slice(1)))),r+=a.length+s.length+l.length}return i},nu=Cr([0,0,0,1]),iu=Cr([0,0,1]),ru=Cr([0,0,3]),au=function(e){for(var t=[],n=1;n<e.length-2;)Pr(e.subarray(n,n+3),ru)&&(t.push(n+2),n++),n++;if(0===t.length)return e;var i=e.length-t.length,r=new Uint8Array(i),a=0;for(n=0;n<i;a++,n++)a===t[0]&&(a++,t.shift()),r[n]=e[a];return r},su=function(e,t,n,i){e=Cr(e),n=[].concat(n);for(var r,a=0,s=0;a<e.length&&(s<i||r);){var o=void 0;if(Pr(e.subarray(a),nu)?o=4:Pr(e.subarray(a),iu)&&(o=3),o){if(s++,r)return au(e.subarray(r,a));var u=void 0;"h264"===t?u=31&e[a+o]:"h265"===t&&(u=e[a+o]>>1&63),-1!==n.indexOf(u)&&(r=a+o),a+=o+("h264"===t?1:2)}else a++}return e.subarray(0,0)},ou={webm:Cr([119,101,98,109]),matroska:Cr([109,97,116,114,111,115,107,97]),flac:Cr([102,76,97,67]),ogg:Cr([79,103,103,83]),ac3:Cr([11,119]),riff:Cr([82,73,70,70]),avi:Cr([65,86,73]),wav:Cr([87,65,86,69]),"3gp":Cr([102,116,121,112,51,103]),mp4:Cr([102,116,121,112]),fmp4:Cr([115,116,121,112]),mov:Cr([102,116,121,112,113,116]),moov:Cr([109,111,111,118]),moof:Cr([109,111,111,102])},uu={aac:function(e){var t=Xo(e);return Pr(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Xo(e);return Pr(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=tu(e,[Qo.EBML,Qo.DocType])[0];return Pr(t,ou.webm)},mkv:function(e){var t=tu(e,[Qo.EBML,Qo.DocType])[0];return Pr(t,ou.matroska)},mp4:function(e){return!uu["3gp"](e)&&!uu.mov(e)&&(!(!Pr(e,ou.mp4,{offset:4})&&!Pr(e,ou.fmp4,{offset:4}))||(!(!Pr(e,ou.moof,{offset:4})&&!Pr(e,ou.moov,{offset:4}))||void 0))},mov:function(e){return Pr(e,ou.mov,{offset:4})},"3gp":function(e){return Pr(e,ou["3gp"],{offset:4})},ac3:function(e){var t=Xo(e);return Pr(e,ou.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+188<e.length&&t<188;){if(71===e[t]&&71===e[t+188])return!0;t+=1}return!1},flac:function(e){var t=Xo(e);return Pr(e,ou.flac,{offset:t})},ogg:function(e){return Pr(e,ou.ogg)},avi:function(e){return Pr(e,ou.riff)&&Pr(e,ou.avi,{offset:8})},wav:function(e){return Pr(e,ou.riff)&&Pr(e,ou.wav,{offset:8})},h264:function(e){return function(e,t,n){return su(e,"h264",t,n)}(e,7,3).length},h265:function(e){return function(e,t,n){return su(e,"h265",t,n)}(e,[32,33],3).length}},lu=Object.keys(uu).filter(function(e){return"ts"!==e&&"h264"!==e&&"h265"!==e}).concat(["ts","h264","h265"]);lu.forEach(function(e){var t=uu[e];uu[e]=function(e){return t(Cr(e))}});var cu,du,hu,pu,fu=uu,mu=function(e){e=Cr(e);for(var t=0;t<lu.length;t++){var n=lu[t];if(fu[n](e))return n}return""},gu=9e4;var vu,yu=gu,_u=(cu=function(e){return e*gu},du=function(e,t){return e*t},hu=function(e){return e/gu},pu=function(e,t){return e/t},"8.21.0"),bu={},Tu=function(e,t){return bu[e]=bu[e]||[],t&&(bu[e]=bu[e].concat(t)),bu[e]},ku=function(e,t){var n=Tu(e).indexOf(t);return!(n<=-1)&&(bu[e]=bu[e].slice(),bu[e].splice(n,1),!0)},Su={prefixed:!0},wu=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Eu=wu[0];for(Ki=0;Ki<wu.length;Ki++)if(wu[Ki][1]in Ln){vu=wu[Ki];break}if(vu){for(var Cu=0;Cu<vu.length;Cu++)Su[Eu[Cu]]=vu[Cu];Su.prefixed=vu[0]!==Eu[0]}var Au=[];var Iu=function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:":",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a="info";function s(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n("log",a,t)}return n=function(e,t,n){return function(i,r,a){var s=t.levels[r],o=new RegExp("^(".concat(s,")$")),u=e;if("log"!==i&&a.unshift(i.toUpperCase()+":"),n&&(u="%c".concat(e),a.unshift(n)),a.unshift(u+":"),Au){Au.push([].concat(a));var l=Au.length-1e3;Au.splice(0,l>0?l:0)}if(wn.console){var c=wn.console[i];c||"debug"!==i||(c=wn.console.info||wn.console.log),c&&s&&o.test(i)&&c[Array.isArray(a)?"apply":"call"](wn.console,a)}}}(t,s,r),s.createLogger=function(n,a,s){var o=void 0!==a?a:i,u=void 0!==s?s:r;return e("".concat(t," ").concat(o," ").concat(n),o,u)},s.createNewLogger=function(t,n,i){return e(t,n,i)},s.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:a},s.level=function(e){if("string"==typeof e){if(!s.levels.hasOwnProperty(e))throw new Error('"'.concat(e,'" in not a valid log level'));a=e}return a},s.history=function(){return Au?[].concat(Au):[]},s.history.filter=function(e){return(Au||[]).filter(function(t){return new RegExp(".*".concat(e,".*")).test(t[0])})},s.history.clear=function(){Au&&(Au.length=0)},s.history.disable=function(){null!==Au&&(Au.length=0,Au=null)},s.history.enable=function(){null===Au&&(Au=[])},s.error=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n("error",a,t)},s.warn=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n("warn",a,t)},s.debug=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n("debug",a,t)},s}("VIDEOJS"),xu=Iu.createLogger,Lu=Object.prototype.toString,Du=function(e){return Ou(e)?Object.keys(e):[]};function Pu(e,t){Du(e).forEach(function(n){return t(e[n],n)})}function Ru(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Du(e).reduce(function(n,i){return t(n,e[i],i)},n)}function Ou(e){return!!e&&"object"===k(e)}function Nu(e){return Ou(e)&&"[object Object]"===Lu.call(e)&&e.constructor===Object}function Uu(){for(var e={},t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return n.forEach(function(t){t&&Pu(t,function(t,n){Nu(t)?(Nu(e[n])||(e[n]={}),e[n]=Uu(e[n],t)):e[n]=t})}),e}function Mu(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[];for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];t.push(i)}return t}function Bu(e,t,n){var i=function(n){return Object.defineProperty(e,t,{value:n,enumerable:!0,writable:!0})},r={configurable:!0,enumerable:!0,get:function(){var e=n();return i(e),e}};return(!(arguments.length>3&&void 0!==arguments[3])||arguments[3])&&(r.set=i),Object.defineProperty(e,t,r)}var ju,Fu,qu,Vu,Hu=Object.freeze({__proto__:null,each:Pu,reduce:Ru,isObject:Ou,isPlain:Nu,merge:Uu,values:Mu,defineLazyProperty:Bu}),zu=!1,Wu=null,Gu=!1,Xu=!1,Ku=!1,Yu=!1,Qu=!1,$u=null,Ju=null,Zu=Boolean(wn.cast&&wn.cast.framework&&wn.cast.framework.CastReceiverContext),el=null,tl=!1,nl=!1,il=!1,rl=!1,al=!1,sl=!1,ol=!1,ul=Boolean(ml()&&("ontouchstart"in wn||wn.navigator.maxTouchPoints||wn.DocumentTouch&&wn.document instanceof wn.DocumentTouch)),ll=wn.navigator&&wn.navigator.userAgentData;if(ll&&ll.platform&&ll.brands&&(Gu="Android"===ll.platform,Ku=Boolean(ll.brands.find(function(e){return"Microsoft Edge"===e.brand})),Yu=Boolean(ll.brands.find(function(e){return"Chromium"===e.brand})),Qu=!Ku&&Yu,$u=Ju=(ll.brands.find(function(e){return"Chromium"===e.brand})||{}).version||null,nl="Windows"===ll.platform),!Yu){var cl=wn.navigator&&wn.navigator.userAgent||"";zu=/iPod/i.test(cl),Vu=cl.match(/OS (\d+)_/i),Wu=Vu&&Vu[1]?Vu[1]:null,Gu=/Android/i.test(cl),ju=function(){var e=cl.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),Xu=/Firefox/i.test(cl),Ku=/Edg/i.test(cl),Yu=/Chrome/i.test(cl)||/CriOS/i.test(cl),Qu=!Ku&&Yu,$u=Ju=function(){var e=cl.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Fu=/MSIE\s(\d+)\.\d/.exec(cl),!(qu=Fu&&parseFloat(Fu[1]))&&/Trident\/7.0/i.test(cl)&&/rv:11.0/.test(cl)&&(qu=11),el=qu,al=/Tizen/i.test(cl),sl=/Web0S/i.test(cl),ol=al||sl,tl=/Safari/i.test(cl)&&!Qu&&!Gu&&!Ku&&!ol,nl=/Windows/i.test(cl),il=/iPad/i.test(cl)||tl&&ul&&!/iPhone/i.test(cl),rl=/iPhone/i.test(cl)&&!il}var dl=rl||il||zu,hl=(tl||dl)&&!Qu,pl=Object.freeze({__proto__:null,get IS_IPOD(){return zu},get IOS_VERSION(){return Wu},get IS_ANDROID(){return Gu},get ANDROID_VERSION(){return ju},get IS_FIREFOX(){return Xu},get IS_EDGE(){return Ku},get IS_CHROMIUM(){return Yu},get IS_CHROME(){return Qu},get CHROMIUM_VERSION(){return $u},get CHROME_VERSION(){return Ju},IS_CHROMECAST_RECEIVER:Zu,get IE_VERSION(){return el},get IS_SAFARI(){return tl},get IS_WINDOWS(){return nl},get IS_IPAD(){return il},get IS_IPHONE(){return rl},get IS_TIZEN(){return al},get IS_WEBOS(){return sl},get IS_SMART_TV(){return ol},TOUCH_ENABLED:ul,IS_IOS:dl,IS_ANY_SAFARI:hl});function fl(e){return"string"==typeof e&&Boolean(e.trim())}function ml(){return Ln===wn.document}function gl(e){return Ou(e)&&1===e.nodeType}function vl(){try{return wn.parent!==wn.self}catch(e){return!0}}function yl(e){return function(t,n){if(!fl(t))return Ln[e](null);fl(n)&&(n=Ln.querySelector(n));var i=gl(n)?n:Ln;return i[e]&&i[e](t)}}function _l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,r=Ln.createElement(e);return Object.getOwnPropertyNames(t).forEach(function(e){var n=t[e];"textContent"===e?bl(r,n):r[e]===n&&"tabIndex"!==e||(r[e]=n)}),Object.getOwnPropertyNames(n).forEach(function(e){r.setAttribute(e,n[e])}),i&&jl(r,i),r}function bl(e,t){return void 0===e.textContent?e.innerText=t:e.textContent=t,e}function Tl(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function kl(e,t){return function(e){if(e.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}(t),e.classList.contains(t)}function Sl(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return(t=e.classList).add.apply(t,b(i.reduce(function(e,t){return e.concat(t.split(/\s+/))},[]))),e}function wl(e){var t;if(!e)return Iu.warn("removeClass was called with an element that doesn't exist"),null;for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return(t=e.classList).remove.apply(t,b(i.reduce(function(e,t){return e.concat(t.split(/\s+/))},[]))),e}function El(e,t,n){return"function"==typeof n&&(n=n(e,t)),"boolean"!=typeof n&&(n=void 0),t.split(/\s+/).forEach(function(t){return e.classList.toggle(t,n)}),e}function Cl(e,t){Object.getOwnPropertyNames(t).forEach(function(n){var i=t[n];null==i||!1===i?e.removeAttribute(n):e.setAttribute(n,!0===i?"":i)})}function Al(e){var t={},n=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(e&&e.attributes&&e.attributes.length>0)for(var i=e.attributes,r=i.length-1;r>=0;r--){var a=i[r].name,s=i[r].value;n.includes(a)&&(s=null!==s),t[a]=s}return t}function Il(e,t){return e.getAttribute(t)}function xl(e,t,n){e.setAttribute(t,n)}function Ll(e,t){e.removeAttribute(t)}function Dl(){Ln.body.focus(),Ln.onselectstart=function(){return!1}}function Pl(){Ln.onselectstart=function(){return!0}}function Rl(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),n={};return["bottom","height","left","right","top","width"].forEach(function(e){void 0!==t[e]&&(n[e]=t[e])}),n.height||(n.height=parseFloat(zl(e,"height"))),n.width||(n.width=parseFloat(zl(e,"width"))),n}}function Ol(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,n=e.offsetHeight,i=0,r=0;e.offsetParent&&e!==Ln[Su.fullscreenElement];)i+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:i,top:r,width:t,height:n}}function Nl(e,t){var n={x:0,y:0};if(dl)for(var i=e;i&&"html"!==i.nodeName.toLowerCase();){var r=zl(i,"transform");if(/^matrix/.test(r)){var a=r.slice(7,-1).split(/,\s/).map(Number);n.x+=a[4],n.y+=a[5]}else if(/^matrix3d/.test(r)){var s=r.slice(9,-1).split(/,\s/).map(Number);n.x+=s[12],n.y+=s[13]}if(i.assignedSlot&&i.assignedSlot.parentElement&&wn.WebKitCSSMatrix){var o=wn.getComputedStyle(i.assignedSlot.parentElement).transform,u=new wn.WebKitCSSMatrix(o);n.x+=u.m41,n.y+=u.m42}i=i.parentNode||i.host}var l={},c=Ol(t.target),d=Ol(e),h=d.width,p=d.height,f=t.offsetY-(d.top-c.top),m=t.offsetX-(d.left-c.left);return t.changedTouches&&(m=t.changedTouches[0].pageX-d.left,f=t.changedTouches[0].pageY+d.top,dl&&(m-=n.x,f-=n.y)),l.y=1-Math.max(0,Math.min(1,f/p)),l.x=Math.max(0,Math.min(1,m/h)),l}function Ul(e){return Ou(e)&&3===e.nodeType}function Ml(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Bl(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(function(e){return"function"==typeof e&&(e=e()),gl(e)||Ul(e)?e:"string"==typeof e&&/\S/.test(e)?Ln.createTextNode(e):void 0}).filter(function(e){return e})}function jl(e,t){return Bl(t).forEach(function(t){return e.appendChild(t)}),e}function Fl(e,t){return jl(Ml(e),t)}function ql(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||("mousedown"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons)))}var Vl=yl("querySelector"),Hl=yl("querySelectorAll");function zl(e,t){if(!e||!t)return"";if("function"==typeof wn.getComputedStyle){var n;try{n=wn.getComputedStyle(e)}catch(vy){return""}return n?n.getPropertyValue(t)||n[t]:""}return""}function Wl(e){b(Ln.styleSheets).forEach(function(t){try{var n=b(t.cssRules).map(function(e){return e.cssText}).join(""),i=Ln.createElement("style");i.textContent=n,e.document.head.appendChild(i)}catch(vy){var r=Ln.createElement("link");r.rel="stylesheet",r.type=t.type,r.media=t.media.mediaText,r.href=t.href,e.document.head.appendChild(r)}})}var Gl,Xl=Object.freeze({__proto__:null,isReal:ml,isEl:gl,isInFrame:vl,createEl:_l,textContent:bl,prependTo:Tl,hasClass:kl,addClass:Sl,removeClass:wl,toggleClass:El,setAttributes:Cl,getAttributes:Al,getAttribute:Il,setAttribute:xl,removeAttribute:Ll,blockTextSelection:Dl,unblockTextSelection:Pl,getBoundingClientRect:Rl,findPosition:Ol,getPointerPosition:Nl,isTextNode:Ul,emptyEl:Ml,normalizeContent:Bl,appendContent:jl,insertContent:Fl,isSingleLeftClick:ql,$:Vl,$$:Hl,computedStyle:zl,copyStyleSheetsToWindow:Wl}),Kl=!1,Yl=function(){if(!1!==Gl.options.autoSetup){var e=Array.prototype.slice.call(Ln.getElementsByTagName("video")),t=Array.prototype.slice.call(Ln.getElementsByTagName("audio")),n=Array.prototype.slice.call(Ln.getElementsByTagName("video-js")),i=e.concat(t,n);if(i&&i.length>0)for(var r=0,a=i.length;r<a;r++){var s=i[r];if(!s||!s.getAttribute){Ql(1);break}void 0===s.player&&null!==s.getAttribute("data-setup")&&Gl(s)}else Kl||Ql(1)}};function Ql(e,t){ml()&&(t&&(Gl=t),wn.setTimeout(Yl,e))}function $l(){Kl=!0,wn.removeEventListener("load",$l)}ml()&&("complete"===Ln.readyState?$l():wn.addEventListener("load",$l));var Jl,Zl=function(e){var t=Ln.createElement("style");return t.className=e,t},ec=function(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t},tc=new WeakMap,nc=3;function ic(){return nc++}function rc(e,t){if(tc.has(e)){var n=tc.get(e);0===n.handlers[t].length&&(delete n.handlers[t],e.removeEventListener?e.removeEventListener(t,n.dispatcher,!1):e.detachEvent&&e.detachEvent("on"+t,n.dispatcher)),Object.getOwnPropertyNames(n.handlers).length<=0&&(delete n.handlers,delete n.dispatcher,delete n.disabled),0===Object.getOwnPropertyNames(n).length&&tc.delete(e)}}function ac(e,t,n,i){n.forEach(function(n){e(t,n,i)})}function sc(e){if(e.fixed_)return e;function t(){return!0}function n(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){var i=e||wn.event;e={};var r=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(var a in i)r.includes(a)||"returnValue"===a&&i.preventDefault||(e[a]=i[a]);if(e.target||(e.target=e.srcElement||Ln),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){i.preventDefault&&i.preventDefault(),e.returnValue=!1,i.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),e.cancelBubble=!0,i.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=n,e.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=n,null!==e.clientX&&void 0!==e.clientX){var s=Ln.documentElement,o=Ln.body;e.pageX=e.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=e.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)}e.which=e.charCode||e.keyCode,null!==e.button&&void 0!==e.button&&(e.button=1&e.button?0:4&e.button?1:2&e.button?2:0)}return e.fixed_=!0,e}var oc=["touchstart","touchmove"];function uc(e,t,n){if(Array.isArray(t))return ac(uc,e,t,n);tc.has(e)||tc.set(e,{});var i=tc.get(e);if(i.handlers||(i.handlers={}),i.handlers[t]||(i.handlers[t]=[]),n.guid||(n.guid=ic()),i.handlers[t].push(n),i.dispatcher||(i.disabled=!1,i.dispatcher=function(t,n){if(!i.disabled){t=sc(t);var r=i.handlers[t.type];if(r)for(var a=r.slice(0),s=0,o=a.length;s<o&&!t.isImmediatePropagationStopped();s++)try{a[s].call(e,t,n)}catch(vy){Iu.error(vy)}}}),1===i.handlers[t].length)if(e.addEventListener){var r=!1;(function(){if("boolean"!=typeof Jl){Jl=!1;try{var e=Object.defineProperty({},"passive",{get:function(){Jl=!0}});wn.addEventListener("test",null,e),wn.removeEventListener("test",null,e)}catch(vy){}}return Jl})()&&oc.indexOf(t)>-1&&(r={passive:!0}),e.addEventListener(t,i.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,i.dispatcher)}function lc(e,t,n){if(tc.has(e)){var i=tc.get(e);if(i.handlers){if(Array.isArray(t))return ac(lc,e,t,n);var r=function(e,t){i.handlers[t]=[],rc(e,t)};if(void 0!==t){var a=i.handlers[t];if(a)if(n){if(n.guid)for(var s=0;s<a.length;s++)a[s].guid===n.guid&&a.splice(s--,1);rc(e,t)}else r(e,t)}else for(var o in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},o)&&r(e,o)}}}function cc(e,t,n){var i=tc.has(e)?tc.get(e):{},r=e.parentNode||e.ownerDocument;if("string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=sc(t),i.dispatcher&&i.dispatcher.call(e,t,n),r&&!t.isPropagationStopped()&&!0===t.bubbles)cc.call(null,r,t,n);else if(!r&&!t.defaultPrevented&&t.target&&t.target[t.type]){tc.has(t.target)||tc.set(t.target,{});var a=tc.get(t.target);t.target[t.type]&&(a.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),a.disabled=!1)}return!t.defaultPrevented}function dc(e,t,n){if(Array.isArray(t))return ac(dc,e,t,n);var i=function(){lc(e,t,i),n.apply(this,arguments)};i.guid=n.guid=n.guid||ic(),uc(e,t,i)}function hc(e,t,n){var i=function(){lc(e,t,i),n.apply(this,arguments)};i.guid=n.guid=n.guid||ic(),uc(e,t,i)}var pc,fc=Object.freeze({__proto__:null,fixEvent:sc,on:uc,off:lc,trigger:cc,one:dc,any:hc}),mc=30,gc=function(e,t,n){t.guid||(t.guid=ic());var i=t.bind(e);return i.guid=n?n+"_"+t.guid:t.guid,i},vc=function(e,t){var n=wn.performance.now();return function(){var i=wn.performance.now();i-n>=t&&(e.apply(void 0,arguments),n=i)}},yc=function(e,t,n){var i,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:wn,a=function(){var a=this,s=arguments,o=function(){i=null,o=null,n||e.apply(a,s)};!i&&n&&e.apply(a,s),r.clearTimeout(i),i=r.setTimeout(o,t)};return a.cancel=function(){r.clearTimeout(i),i=null},a},_c=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:mc,bind_:gc,throttle:vc,debounce:yc}),bc=function(){return y(function e(){g(this,e)},[{key:"on",value:function(e,t){var n=this.addEventListener;this.addEventListener=function(){},uc(this,e,t),this.addEventListener=n}},{key:"off",value:function(e,t){lc(this,e,t)}},{key:"one",value:function(e,t){var n=this.addEventListener;this.addEventListener=function(){},dc(this,e,t),this.addEventListener=n}},{key:"any",value:function(e,t){var n=this.addEventListener;this.addEventListener=function(){},hc(this,e,t),this.addEventListener=n}},{key:"trigger",value:function(e){var t=e.type||e;"string"==typeof e&&(e={type:t}),e=sc(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),cc(this,e)}},{key:"queueTrigger",value:function(e){var t=this;pc||(pc=new Map);var n=e.type||e,i=pc.get(this);i||(i=new Map,pc.set(this,i));var r=i.get(n);i.delete(n),wn.clearTimeout(r);var a=wn.setTimeout(function(){i.delete(n),0===i.size&&(i=null,pc.delete(t)),t.trigger(e)},0);i.set(n,a)}}])}();bc.prototype.allowedEvents_={},bc.prototype.addEventListener=bc.prototype.on,bc.prototype.removeEventListener=bc.prototype.off,bc.prototype.dispatchEvent=bc.prototype.trigger;var Tc=function(e){return"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:k(e)},kc=function(e){return e instanceof bc||!!e.eventBusEl_&&["on","one","off","trigger"].every(function(t){return"function"==typeof e[t]})},Sc=function(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},wc=function(e,t,n){if(!e||!e.nodeName&&!kc(e))throw new Error("Invalid target for ".concat(Tc(t),"#").concat(n,"; must be a DOM node or evented object."))},Ec=function(e,t,n){if(!Sc(e))throw new Error("Invalid event type for ".concat(Tc(t),"#").concat(n,"; must be a non-empty string or array."))},Cc=function(e,t,n){if("function"!=typeof e)throw new Error("Invalid listener for ".concat(Tc(t),"#").concat(n,"; must be a function."))},Ac=function(e,t,n){var i,r,a,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;if(s){i=e.eventBusEl_,t.length>=3&&t.shift();var o=S(t,2);r=o[0],a=o[1]}else i=t[0],r=t[1],a=t[2];return wc(i,e,n),Ec(r,e,n),Cc(a,e,n),{isTargetingSelf:s,target:i,type:r,listener:a=gc(e,a)}},Ic=function(e,t,n,i){wc(e,e,t),e.nodeName?fc[t](e,n,i):e[t](n,i)},xc={on:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=Ac(this,n,"on"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(Ic(s,"on",o,u),!a){var l=function(){return e.off(s,o,u)};l.guid=u.guid;var c=function(){return e.off("dispose",l)};c.guid=u.guid,Ic(this,"on","dispose",l),Ic(s,"on","dispose",c)}},one:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=Ac(this,n,"one"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)Ic(s,"one",o,u);else{var l=function(){e.off(s,o,l);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];u.apply(null,n)};l.guid=u.guid,Ic(s,"one",o,l)}},any:function(){for(var e=this,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];var r=Ac(this,n,"any"),a=r.isTargetingSelf,s=r.target,o=r.type,u=r.listener;if(a)Ic(s,"any",o,u);else{var l=function(){e.off(s,o,l);for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];u.apply(null,n)};l.guid=u.guid,Ic(s,"any",o,l)}},off:function(e,t,n){if(!e||Sc(e))lc(this.eventBusEl_,e,t);else{var i=e,r=t;wc(i,this,"off"),Ec(r,this,"off"),Cc(n,this,"off"),n=gc(this,n),this.off("dispose",n),i.nodeName?(lc(i,r,n),lc(i,"dispose",n)):kc(i)&&(i.off(r,n),i.off("dispose",n))}},trigger:function(e,t){wc(this.eventBusEl_,this,"trigger");var n=e&&"string"!=typeof e?e.type:e;if(!Sc(n))throw new Error("Invalid event type for ".concat(Tc(this),"#trigger; ")+"must be a non-empty string or object with a type key that has a non-empty value.");return cc(this.eventBusEl_,e,t)}};function Lc(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).eventBusKey;if(t){if(!e[t].nodeName)throw new Error('The eventBusKey "'.concat(t,'" does not refer to an element.'));e.eventBusEl_=e[t]}else e.eventBusEl_=_l("span",{className:"vjs-event-bus"});return Object.assign(e,xc),e.eventedCallbacks&&e.eventedCallbacks.forEach(function(e){e()}),e.on("dispose",function(){e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&tc.has(e)&&tc.delete(e)}),wn.setTimeout(function(){e.eventBusEl_=null},0)}),e}var Dc={state:{},setState:function(e){var t,n=this;return"function"==typeof e&&(e=e()),Pu(e,function(e,i){n.state[i]!==e&&((t=t||{})[i]={from:n.state[i],to:e}),n.state[i]=e}),t&&kc(this)&&this.trigger({changes:t,type:"statechanged"}),t}};function Pc(e,t){return Object.assign(e,Dc),e.state=Object.assign({},e.state,t),"function"==typeof e.handleStateChanged&&kc(e)&&e.on("statechanged",e.handleStateChanged),e}var Rc=function(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toLowerCase()})},Oc=function(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toUpperCase()})},Nc=function(e,t){return Oc(e)===Oc(t)},Uc=Object.freeze({__proto__:null,toLowerCase:Rc,toTitleCase:Oc,titleCaseEquals:Nc}),Mc=function(){function e(t,n,i){var r=this;if(g(this,e),!t&&this.play?this.player_=t=this:this.player_=t,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Uu({},this.options_),n=this.options_=Uu(this.options_,n),this.id_=n.id||n.el&&n.el.id,!this.id_){var a=t&&t.id&&t.id()||"no_player";this.id_="".concat(a,"_component_").concat(ic())}this.name_=n.name||null,n.el?this.el_=n.el:!1!==n.createEl&&(this.el_=this.createEl()),n.className&&this.el_&&n.className.split(" ").forEach(function(e){return r.addClass(e)}),["on","off","one","any","trigger"].forEach(function(e){r[e]=void 0}),!1!==n.evented&&(Lc(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Pc(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,!1!==n.initChildren&&this.initChildren(),this.ready(i),!1!==n.reportTouchActivity&&this.enableTouchActivity()}return y(e,[{key:"dispose",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var 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}}},{key:"isDisposed",value:function(){return Boolean(this.isDisposed_)}},{key:"player",value:function(){return this.player_}},{key:"options",value:function(e){return e?(this.options_=Uu(this.options_,e),this.options_):this.options_}},{key:"el",value:function(){return this.el_}},{key:"createEl",value:function(e,t,n){return _l(e,t,n)}},{key:"localize",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,i=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[i],s=i&&i.split("-")[0],o=r&&r[s],u=n;return a&&a[e]?u=a[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,function(e,n){var i=t[n-1],r=i;return void 0===i&&(r=e),r})),u}},{key:"handleLanguagechange",value:function(){}},{key:"contentEl",value:function(){return this.contentEl_||this.el_}},{key:"id",value:function(){return this.id_}},{key:"name",value:function(){return this.name_}},{key:"children",value:function(){return this.children_}},{key:"getChildById",value:function(e){return this.childIndex_[e]}},{key:"getChild",value:function(e){if(e)return this.childNameIndex_[e]}},{key:"getDescendant",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t=t.reduce(function(e,t){return e.concat(t)},[]);for(var i=this,r=0;r<t.length;r++)if(!(i=i.getChild(t[r]))||!i.getChild)return;return i}},{key:"setIcon",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.el();if(this.player_.options_.experimentalSvgIcons){var n="http://www.w3.org/2000/svg",i=_l("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),r=Ln.createElementNS(n,"svg");r.setAttributeNS(null,"viewBox","0 0 512 512");var a=Ln.createElementNS(n,"use");return r.appendChild(a),a.setAttributeNS(null,"href","#vjs-icon-".concat(e)),i.appendChild(r),this.iconIsSet_?t.replaceChild(i,t.querySelector(".vjs-icon-placeholder")):t.appendChild(i),this.iconIsSet_=!0,i}}},{key:"addChild",value:function(t){var n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.children_.length;if("string"==typeof t){i=Oc(t);var s=r.componentClass||i;r.name=i;var o=e.getComponent(s);if(!o)throw new Error("Component ".concat(s," does not exist"));if("function"!=typeof o)return null;n=new o(this.player_||this,r)}else n=t;if(n.parentComponent_&&n.parentComponent_.removeChild(n),this.children_.splice(a,0,n),n.parentComponent_=this,"function"==typeof n.id&&(this.childIndex_[n.id()]=n),(i=i||n.name&&Oc(n.name()))&&(this.childNameIndex_[i]=n,this.childNameIndex_[Rc(i)]=n),"function"==typeof n.el&&n.el()){var u=null;this.children_[a+1]&&(this.children_[a+1].el_?u=this.children_[a+1].el_:gl(this.children_[a+1])&&(u=this.children_[a+1])),this.contentEl().insertBefore(n.el(),u)}return n}},{key:"removeChild",value:function(e){if("string"==typeof e&&(e=this.getChild(e)),e&&this.children_){for(var t=!1,n=this.children_.length-1;n>=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Oc(e.name())]=null,this.childNameIndex_[Rc(e.name())]=null;var i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}}},{key:"initChildren",value:function(){var t=this,n=this.options_.children;if(n){var i,r=this.options_,a=e.getComponent("Tech");(i=Array.isArray(n)?n:Object.keys(n)).concat(Object.keys(this.options_).filter(function(e){return!i.some(function(t){return"string"==typeof t?e===t:e===t.name})})).map(function(e){var i,r;return"string"==typeof e?r=n[i=e]||t.options_[i]||{}:(i=e.name,r=e),{name:i,opts:r}}).filter(function(t){var n=e.getComponent(t.opts.componentClass||Oc(t.name));return n&&!a.isTech(n)}).forEach(function(e){var n=e.name,i=e.opts;if(void 0!==r[n]&&(i=r[n]),!1!==i){!0===i&&(i={}),i.playerOptions=t.options_.playerOptions;var a=t.addChild(n,i);a&&(t[n]=a)}})}}},{key:"buildCSSClass",value:function(){return""}},{key:"ready",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))}},{key:"triggerReady",value:function(){this.isReady_=!0,this.setTimeout(function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(e){e.call(this)},this),this.trigger("ready")},1)}},{key:"$",value:function(e,t){return Vl(e,t||this.contentEl())}},{key:"$$",value:function(e,t){return Hl(e,t||this.contentEl())}},{key:"hasClass",value:function(e){return kl(this.el_,e)}},{key:"addClass",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Sl.apply(void 0,[this.el_].concat(t))}},{key:"removeClass",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];wl.apply(void 0,[this.el_].concat(t))}},{key:"toggleClass",value:function(e,t){El(this.el_,e,t)}},{key:"show",value:function(){this.removeClass("vjs-hidden")}},{key:"hide",value:function(){this.addClass("vjs-hidden")}},{key:"lockShowing",value:function(){this.addClass("vjs-lock-showing")}},{key:"unlockShowing",value:function(){this.removeClass("vjs-lock-showing")}},{key:"getAttribute",value:function(e){return Il(this.el_,e)}},{key:"setAttribute",value:function(e,t){xl(this.el_,e,t)}},{key:"removeAttribute",value:function(e){Ll(this.el_,e)}},{key:"width",value:function(e,t){return this.dimension("width",e,t)}},{key:"height",value:function(e,t){return this.dimension("height",e,t)}},{key:"dimensions",value:function(e,t){this.width(e,!0),this.height(t)}},{key:"dimension",value:function(e,t,n){if(void 0!==t)return null!==t&&t==t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(n||this.trigger("componentresize"));if(!this.el_)return 0;var i=this.el_.style[e],r=i.indexOf("px");return-1!==r?parseInt(i.slice(0,r),10):parseInt(this.el_["offset"+Oc(e)],10)}},{key:"currentDimension",value:function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=zl(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var n="offset".concat(Oc(e));t=this.el_[n]}return t}},{key:"currentDimensions",value:function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}},{key:"currentWidth",value:function(){return this.currentDimension("width")}},{key:"currentHeight",value:function(){return this.currentDimension("height")}},{key:"getPositions",value:function(){var e=this.el_.getBoundingClientRect();return{boundingClientRect:{x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},center:{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}}}},{key:"focus",value:function(){this.el_.focus()}},{key:"blur",value:function(){this.el_.blur()}},{key:"handleKeyDown",value:function(e){this.player_&&("Tab"===e.key||this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled||e.stopPropagation(),this.player_.handleKeyDown(e))}},{key:"handleKeyPress",value:function(e){this.handleKeyDown(e)}},{key:"emitTapEvents",value:function(){var e,t=0,n=null;this.on("touchstart",function(i){1===i.touches.length&&(n={pageX:i.touches[0].pageX,pageY:i.touches[0].pageY},t=wn.performance.now(),e=!0)}),this.on("touchmove",function(t){if(t.touches.length>1)e=!1;else if(n){var i=t.touches[0].pageX-n.pageX,r=t.touches[0].pageY-n.pageY;Math.sqrt(i*i+r*r)>10&&(e=!1)}});var i=function(){e=!1};this.on("touchleave",i),this.on("touchcancel",i),this.on("touchend",function(i){(n=null,!0===e)&&(wn.performance.now()-t<200&&(i.preventDefault(),this.trigger("tap")))})}},{key:"enableTouchActivity",value:function(){if(this.player()&&this.player().reportUserActivity){var e,t=gc(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){t(),this.clearInterval(e),e=this.setInterval(t,250)});var n=function(n){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",n),this.on("touchcancel",n)}}},{key:"setTimeout",value:function(e,t){var n,i=this;return e=gc(this,e),this.clearTimersOnDispose_(),n=wn.setTimeout(function(){i.setTimeoutIds_.has(n)&&i.setTimeoutIds_.delete(n),e()},t),this.setTimeoutIds_.add(n),n}},{key:"clearTimeout",value:function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),wn.clearTimeout(e)),e}},{key:"setInterval",value:function(e,t){e=gc(this,e),this.clearTimersOnDispose_();var n=wn.setInterval(e,t);return this.setIntervalIds_.add(n),n}},{key:"clearInterval",value:function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),wn.clearInterval(e)),e}},{key:"requestAnimationFrame",value:function(e){var t,n=this;return this.clearTimersOnDispose_(),e=gc(this,e),t=wn.requestAnimationFrame(function(){n.rafIds_.has(t)&&n.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}},{key:"requestNamedAnimationFrame",value:function(e,t){var n=this;this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=gc(this,t);var i=this.requestAnimationFrame(function(){t(),n.namedRafs_.has(e)&&n.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}},{key:"cancelNamedAnimationFrame",value:function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}},{key:"cancelAnimationFrame",value:function(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),wn.cancelAnimationFrame(e)),e}},{key:"clearTimersOnDispose_",value:function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(t){var n=S(t,2),i=n[0],r=n[1];e[i].forEach(function(t,n){return e[r](n)})}),e.clearingTimersOnDispose_=!1}))}},{key:"getIsDisabled",value:function(){return Boolean(this.el_.disabled)}},{key:"getIsExpresslyInert",value:function(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}},{key:"getIsFocusable",value:function(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}},{key:"getIsAvailableToBeFocused",value:function(e){function t(e){var t=wn.getComputedStyle(e,null),n=t.getPropertyValue("visibility");return"none"!==t.getPropertyValue("display")&&!["hidden","collapse"].includes(n)}return e||(e=this.el()),!!(function(e){if(e.offsetWidth+e.offsetHeight+e.getBoundingClientRect().height+e.getBoundingClientRect().width===0)return!1;var t={x:e.getBoundingClientRect().left+e.offsetWidth/2,y:e.getBoundingClientRect().top+e.offsetHeight/2};if(t.x<0)return!1;if(t.x>(Ln.documentElement.clientWidth||wn.innerWidth))return!1;if(t.y<0)return!1;if(t.y>(Ln.documentElement.clientHeight||wn.innerHeight))return!1;for(var n=Ln.elementFromPoint(t.x,t.y);n;){if(n===e)return!0;if(!n.parentNode)return!1;n=n.parentNode}}(e)&&(n=e,t(n.parentElement)&&t(n)&&"0"!==n.style.opacity&&"0px"!==wn.getComputedStyle(n).height&&"0px"!==wn.getComputedStyle(n).width)&&(!e.parentElement||e.tabIndex>=0));var n}}],[{key:"registerComponent",value:function(t,n){if("string"!=typeof t||!t)throw new Error('Illegal component name, "'.concat(t,'"; must be a non-empty string.'));var i,r=e.getComponent("Tech"),a=r&&r.isTech(n),s=e===n||e.prototype.isPrototypeOf(n.prototype);if(a||!s)throw i=a?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'.concat(t,'"; ').concat(i,"."));t=Oc(t),e.components_||(e.components_={});var o=e.getComponent("Player");if("Player"===t&&o&&o.players){var u=o.players,l=Object.keys(u);if(u&&l.length>0&&l.map(function(e){return u[e]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=n,e.components_[Rc(t)]=n,n}},{key:"getComponent",value:function(t){if(t&&e.components_)return e.components_[t]}}])}();function Bc(e,t,n,i){return function(e,t,n){if("number"!=typeof t||t<0||t>n)throw new Error("Failed to execute '".concat(e,"' on 'TimeRanges': The index provided (").concat(t,") is non-numeric or out of bounds (0-").concat(n,")."))}(e,i,n.length-1),n[i][t]}function jc(e){var t;return t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:Bc.bind(null,"start",0,e),end:Bc.bind(null,"end",1,e)},wn.Symbol&&wn.Symbol.iterator&&(t[wn.Symbol.iterator]=function(){return(e||[]).values()}),t}function Fc(e,t){return Array.isArray(e)?jc(e):void 0===e||void 0===t?jc():jc([[e,t]])}Mc.registerComponent("Component",Mc);var qc=function(e,t){e=e<0?0:e;var n=Math.floor(e%60),i=Math.floor(e/60%60),r=Math.floor(e/3600),a=Math.floor(t/60%60),s=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=i=n="-"),(r=r>0||s>0?r+":":"")+(i=((r||a>=10)&&i<10?"0"+i:i)+":")+(n=n<10?"0"+n:n)},Vc=qc;function Hc(e){Vc=e}function zc(){Vc=qc}function Wc(e){return Vc(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:e)}var Gc=Object.freeze({__proto__:null,createTimeRanges:Fc,createTimeRange:Fc,setFormatTime:Hc,resetFormatTime:zc,formatTime:Wc});function Xc(e,t){var n,i,r=0;if(!t)return 0;e&&e.length||(e=Fc(0,0));for(var a=0;a<e.length;a++)n=e.start(a),(i=e.end(a))>t&&(i=t),r+=i-n;return r/t}function Kc(e){if(e instanceof Kc)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:Ou(e)&&("number"==typeof e.code&&(this.code=e.code),Object.assign(this,e)),this.message||(this.message=Kc.defaultMessages[this.code]||"")}function Yc(e){return null!=e&&"function"==typeof e.then}function Qc(e){Yc(e)&&e.then(null,function(e){})}Kc.prototype.code=0,Kc.prototype.message="",Kc.prototype.status=null,Kc.prototype.metadata=null,Kc.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],Kc.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."},Kc.MEDIA_ERR_CUSTOM=0,Kc.prototype.MEDIA_ERR_CUSTOM=0,Kc.MEDIA_ERR_ABORTED=1,Kc.prototype.MEDIA_ERR_ABORTED=1,Kc.MEDIA_ERR_NETWORK=2,Kc.prototype.MEDIA_ERR_NETWORK=2,Kc.MEDIA_ERR_DECODE=3,Kc.prototype.MEDIA_ERR_DECODE=3,Kc.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Kc.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4,Kc.MEDIA_ERR_ENCRYPTED=5,Kc.prototype.MEDIA_ERR_ENCRYPTED=5;var $c=function(e){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(t,n,i){return e[n]&&(t[n]=e[n]),t},{cues:e.cues&&Array.prototype.map.call(e.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})},Jc=function(e){var t=e.$$("track"),n=Array.prototype.map.call(t,function(e){return e.track});return Array.prototype.map.call(t,function(e){var t=$c(e.track);return e.src&&(t.src=e.src),t}).concat(Array.prototype.filter.call(e.textTracks(),function(e){return-1===n.indexOf(e)}).map($c))},Zc=function(e,t){return e.forEach(function(e){var n=t.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(function(e){return n.addCue(e)})}),t.textTracks()},ed="vjs-modal-dialog",td=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).handleKeyDown_=function(e){return i.handleKeyDown(e)},i.close_=function(e){return i.close(e)},i.opened_=i.hasBeenOpened_=i.hasBeenFilled_=!1,i.closeable(!i.options_.uncloseable),i.content(i.options_.content),i.contentEl_=_l("div",{className:"".concat(ed,"-content")},{role:"document"}),i.descEl_=_l("p",{className:"".concat(ed,"-description vjs-control-text"),id:i.el().getAttribute("aria-describedby")}),bl(i.descEl_,i.description()),i.el_.appendChild(i.descEl_),i.el_.appendChild(i.contentEl_),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":"".concat(this.id(),"_description"),"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"}])}},{key:"dispose",value:function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,n(e,"dispose",this,3)([])}},{key:"buildCSSClass",value:function(){return"".concat(ed," vjs-hidden ").concat(n(e,"buildCSSClass",this,3)([]))}},{key:"label",value:function(){return this.localize(this.options_.label||"Modal Window")}},{key:"description",value:function(){var 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}},{key:"open",value:function(){if(this.opened_)this.options_.fillAlways&&this.fill();else{var 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}}},{key:"opened",value:function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_}},{key:"close",value:function(){if(this.opened_){var 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()}}},{key:"closeable",value:function(e){if("boolean"==typeof e){var t=this.closeable_=!!e,n=this.getChild("closeButton");if(t&&!n){var i=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=i,this.on(n,"close",this.close_)}!t&&n&&(this.off(n,"close",this.close_),this.removeChild(n),n.dispose())}return this.closeable_}},{key:"fill",value:function(){this.fillWith(this.content())}},{key:"fillWith",value:function(e){var t=this.contentEl(),n=t.parentNode,i=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(t),this.empty(),Fl(t,e),this.trigger("modalfill"),i?n.insertBefore(t,i):n.appendChild(t);var r=this.getChild("closeButton");r&&n.appendChild(r.el_),this.trigger("aftermodalfill")}},{key:"empty",value:function(){this.trigger("beforemodalempty"),Ml(this.contentEl()),this.trigger("modalempty")}},{key:"content",value:function(e){return void 0!==e&&(this.content_=e),this.content_}},{key:"conditionalFocus_",value:function(){var e=Ln.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}},{key:"conditionalBlur_",value:function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}},{key:"handleKeyDown",value:function(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),"Escape"===e.key&&this.closeable())return e.preventDefault(),void this.close();if("Tab"===e.key){for(var t,n=this.focusableEls_(),i=this.el_.querySelector(":focus"),r=0;r<n.length;r++)if(i===n[r]){t=r;break}Ln.activeElement===this.el_&&(t=0),e.shiftKey&&0===t?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||t!==n.length-1||(n[0].focus(),e.preventDefault())}}},{key:"focusableEls_",value:function(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,function(e){return(e instanceof wn.HTMLAnchorElement||e instanceof wn.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof wn.HTMLInputElement||e instanceof wn.HTMLSelectElement||e instanceof wn.HTMLTextAreaElement||e instanceof wn.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof wn.HTMLIFrameElement||e instanceof wn.HTMLObjectElement||e instanceof wn.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")})}}])}();td.prototype.options_={pauseOnOpen:!0,temporary:!0},Mc.registerComponent("ModalDialog",td);var nd=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];g(this,e),(t=c(this,e)).tracks_=[],Object.defineProperty(t,"length",{get:function(){return this.tracks_.length}});for(var i=0;i<n.length;i++)t.addTrack(n[i]);return t}return f(e,bc),y(e,[{key:"addTrack",value:function(e){var t=this,n=this.tracks_.length;""+n in this||Object.defineProperty(this,n,{get:function(){return this.tracks_[n]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=function(){t.trigger({track:e,type:"labelchange",target:t})},kc(e)&&e.addEventListener("labelchange",e.labelchange_)}},{key:"removeTrack",value:function(e){for(var t,n=0,i=this.length;n<i;n++)if(this[n]===e){(t=this[n]).off&&t.off(),this.tracks_.splice(n,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}},{key:"getTrackById",value:function(e){for(var t=null,n=0,i=this.length;n<i;n++){var r=this[n];if(r.id===e){t=r;break}}return t}}])}();for(var id in nd.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"},nd.prototype.allowedEvents_)nd.prototype["on"+id]=null;var rd=function(e,t){for(var n=0;n<e.length;n++)Object.keys(e[n]).length&&t.id!==e[n].id&&(e[n].enabled=!1)},ad=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];g(this,e);for(var i=n.length-1;i>=0;i--)if(n[i].enabled){rd(n,n[i]);break}return(t=c(this,e,[n])).changing_=!1,t}return f(e,nd),y(e,[{key:"addTrack",value:function(t){var i=this;t.enabled&&rd(this,t),n(e,"addTrack",this,3)([t]),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,rd(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))}},{key:"removeTrack",value:function(t){n(e,"removeTrack",this,3)([t]),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)}}])}(),sd=function(e,t){for(var n=0;n<e.length;n++)Object.keys(e[n]).length&&t.id!==e[n].id&&(e[n].selected=!1)},od=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];g(this,e);for(var i=n.length-1;i>=0;i--)if(n[i].selected){sd(n,n[i]);break}return(t=c(this,e,[n])).changing_=!1,Object.defineProperty(t,"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),t}return f(e,nd),y(e,[{key:"addTrack",value:function(t){var i=this;t.selected&&sd(this,t),n(e,"addTrack",this,3)([t]),t.addEventListener&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,sd(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))}},{key:"removeTrack",value:function(t){n(e,"removeTrack",this,3)([t]),t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)}}])}(),ud=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,nd),y(e,[{key:"addTrack",value:function(t){var i=this;n(e,"addTrack",this,3)([t]),this.queueChange_||(this.queueChange_=function(){return i.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return i.trigger("selectedlanguagechange")}),t.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(t.kind)&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)}},{key:"removeTrack",value:function(t){n(e,"removeTrack",this,3)([t]),t.removeEventListener&&(this.queueChange_&&t.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&t.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}])}(),ld=function(){return y(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];g(this,e),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var n=0,i=t.length;n<i;n++)this.addTrackElement_(t[n])},[{key:"addTrackElement_",value:function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)}},{key:"getTrackElementByTrack_",value:function(e){for(var t,n=0,i=this.trackElements_.length;n<i;n++)if(e===this.trackElements_[n].track){t=this.trackElements_[n];break}return t}},{key:"removeTrackElement_",value:function(e){for(var t=0,n=this.trackElements_.length;t<n;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}])}(),cd=function(){return y(function e(t){g(this,e),e.prototype.setCues_.call(this,t),Object.defineProperty(this,"length",{get:function(){return this.length_}})},[{key:"setCues_",value:function(e){var t=this.length||0,n=0,i=e.length;this.cues_=e,this.length_=e.length;var r=function(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})};if(t<i)for(n=t;n<i;n++)r.call(this,n)}},{key:"getCueById",value:function(e){for(var t=null,n=0,i=this.length;n<i;n++){var r=this[n];if(r.id===e){t=r;break}}return t}}])}(),dd={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},hd={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},pd={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},fd={disabled:"disabled",hidden:"hidden",showing:"showing"},md=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,e),t=c(this,e);var i={id:n.id||"vjs_track_"+ic(),kind:n.kind||"",language:n.language||""},r=n.label||"",a=function(e){Object.defineProperty(t,e,{get:function(){return i[e]},set:function(){}})};for(var s in i)a(s);return Object.defineProperty(t,"label",{get:function(){return r},set:function(e){e!==r&&(r=e,this.trigger("labelchange"))}}),t}return f(e,bc),y(e)}(),gd=function(e){return new URL(e,Ln.baseURI)},vd=function(e){return new URL(e,Ln.baseURI).href},yd=function(e){if("string"==typeof e){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(t)return t.pop().toLowerCase()}return""},_d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wn.location;return gd(e).origin!==t.origin},bd=Object.freeze({__proto__:null,parseUrl:gd,getAbsoluteURL:vd,getFileExtension:yd,isCrossOrigin:_d}),Td=function(e,t){var n=new wn.WebVTT.Parser(wn,wn.vttjs,wn.WebVTT.StringDecoder()),i=[];n.oncue=function(e){t.addCue(e)},n.onparsingerror=function(e){i.push(e)},n.onflush=function(){t.trigger({type:"loadeddata",target:t})},n.parse(e),i.length>0&&(wn.console&&wn.console.groupCollapsed&&wn.console.groupCollapsed("Text Track parsing errors for ".concat(t.src)),i.forEach(function(e){return Iu.error(e)}),wn.console&&wn.console.groupEnd&&wn.console.groupEnd()),n.flush()},kd=function(e,t){var n={uri:e},i=_d(e);i&&(n.cors=i);var r="use-credentials"===t.tech_.crossOrigin();r&&(n.withCredentials=r),Zn(n,gc(this,function(e,n,i){if(e)return Iu.error(e,n);t.loaded_=!0,"function"!=typeof wn.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],function(e){if("vttjserror"!==e.type)return Td(i,t);Iu.error("vttjs failed to load, stopping trying to process ".concat(t.src))}):Td(i,t)}))},Sd=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(g(this,e),!n.tech)throw new Error("A tech was not provided.");var i=Uu(n,{kind:pd[n.kind]||"subtitles",language:n.language||n.srclang||""}),r=fd[i.mode]||"disabled",a=i.default;"metadata"!==i.kind&&"chapters"!==i.kind||(r="hidden"),(t=c(this,e,[i])).tech_=i.tech,t.cues_=[],t.activeCues_=[],t.preload_=!1!==t.tech_.preloadTextTracks;var s=new cd(t.cues_),o=new cd(t.activeCues_),u=!1;t.timeupdateHandler=gc(t,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))):"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});return t.tech_.one("dispose",function(){t.stopTracking()}),"disabled"!==r&&t.startTracking(),Object.defineProperties(t,{default:{get:function(){return a},set:function(){}},mode:{get:function(){return r},set:function(e){fd[e]&&r!==e&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||kd(this.src,this),this.stopTracking(),"disabled"!==r&&this.startTracking(),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],n=0,i=this.cues.length;n<i;n++){var r=this.cues[n];r.startTime<=e&&r.endTime>=e&&t.push(r)}if(u=!1,t.length!==this.activeCues_.length)u=!0;else for(var a=0;a<t.length;a++)-1===this.activeCues_.indexOf(t[a])&&(u=!0);return this.activeCues_=t,o.setCues_(this.activeCues_),o},set:function(){}}}),i.src?(t.src=i.src,t.preload_||(t.loaded_=!0),(t.preload_||"subtitles"!==i.kind&&"captions"!==i.kind)&&kd(t.src,t)):t.loaded_=!0,t}return f(e,md),y(e,[{key:"startTracking",value:function(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}},{key:"stopTracking",value:function(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}},{key:"addCue",value:function(e){var t=e;if(!("getCueAsHTML"in t)){for(var n in t=new wn.vttjs.VTTCue(e.startTime,e.endTime,e.text),e)n in t||(t[n]=e[n]);t.id=e.id,t.originalCue_=e}for(var i=this.tech_.textTracks(),r=0;r<i.length;r++)i[r]!==this&&i[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}},{key:"removeCue",value:function(e){for(var t=this.cues_.length;t--;){var n=this.cues_[t];if(n===e||n.originalCue_&&n.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}])}();Sd.prototype.allowedEvents_={cuechange:"cuechange"};var wd=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,e);var i=Uu(n,{kind:hd[n.kind]||""});t=c(this,e,[i]);var r=!1;return Object.defineProperty(t,"enabled",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("enabledchange"))}}),i.enabled&&(t.enabled=i.enabled),t.loaded_=!0,t}return f(e,md),y(e)}(),Ed=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,e);var i=Uu(n,{kind:dd[n.kind]||""});t=c(this,e,[i]);var r=!1;return Object.defineProperty(t,"selected",{get:function(){return r},set:function(e){"boolean"==typeof e&&e!==r&&(r=e,this.trigger("selectedchange"))}}),i.selected&&(t.selected=i.selected),t}return f(e,md),y(e)}(),Cd=function(){function e(){var t,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,e),t=c(this,e);var r=new Sd(i);return t.kind=r.kind,t.src=r.src,t.srclang=r.language,t.label=r.label,t.default=r.default,Object.defineProperties(t,{readyState:{get:function(){return n}},track:{get:function(){return r}}}),n=e.NONE,r.addEventListener("loadeddata",function(){n=e.LOADED,t.trigger({type:"load",target:t})}),t}return f(e,bc),y(e)}();Cd.prototype.allowedEvents_={load:"load"},Cd.NONE=0,Cd.LOADING=1,Cd.LOADED=2,Cd.ERROR=3;var Ad={audio:{ListClass:ad,TrackClass:wd,capitalName:"Audio"},video:{ListClass:od,TrackClass:Ed,capitalName:"Video"},text:{ListClass:ud,TrackClass:Sd,capitalName:"Text"}};Object.keys(Ad).forEach(function(e){Ad[e].getterName="".concat(e,"Tracks"),Ad[e].privateName="".concat(e,"Tracks_")});var Id={remoteText:{ListClass:ud,TrackClass:Sd,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:ld,TrackClass:Cd,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},xd=Object.assign({},Ad,Id);Id.names=Object.keys(Id),Ad.names=Object.keys(Ad),xd.names=[].concat(Id.names).concat(Ad.names);var Ld=function(){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};return g(this,e),n.reportTouchActivity=!1,(t=c(this,e,[null,n,i])).onDurationChange_=function(e){return t.onDurationChange(e)},t.trackProgress_=function(e){return t.trackProgress(e)},t.trackCurrentTime_=function(e){return t.trackCurrentTime(e)},t.stopTrackingCurrentTime_=function(e){return t.stopTrackingCurrentTime(e)},t.disposeSourceHandler_=function(e){return t.disposeSourceHandler(e)},t.queuedHanders_=new Set,t.hasStarted_=!1,t.on("playing",function(){this.hasStarted_=!0}),t.on("loadstart",function(){this.hasStarted_=!1}),xd.names.forEach(function(e){var i=xd[e];n&&n[i.getterName]&&(t[i.privateName]=n[i.getterName])}),t.featuresProgressEvents||t.manualProgressOn(),t.featuresTimeupdateEvents||t.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(e){!1===n["native".concat(e,"Tracks")]&&(t["featuresNative".concat(e,"Tracks")]=!1)}),!1===n.nativeCaptions||!1===n.nativeTextTracks?t.featuresNativeTextTracks=!1:!0!==n.nativeCaptions&&!0!==n.nativeTextTracks||(t.featuresNativeTextTracks=!0),t.featuresNativeTextTracks||t.emulateTextTracks(),t.preloadTextTracks=!1!==n.preloadTextTracks,t.autoRemoteTextTracks_=new xd.text.ListClass,t.initTrackListeners(),n.nativeControlsForTouch||t.emitTapEvents(),t.constructor&&(t.name_=t.constructor.name||"Unknown Tech"),t}return f(e,Mc),y(e,[{key:"triggerSourceset",value:function(e){var t=this;this.isReady_||this.one("ready",function(){return t.setTimeout(function(){return t.triggerSourceset(e)},1)}),this.trigger({src:e,type:"sourceset"})}},{key:"manualProgressOn",value:function(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}},{key:"manualProgressOff",value:function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}},{key:"trackProgress",value:function(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(gc(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),this.bufferedPercent_=e,1===e&&this.stopTrackingProgress()}),500)}},{key:"onDurationChange",value:function(e){this.duration_=this.duration()}},{key:"buffered",value:function(){return Fc(0,0)}},{key:"bufferedPercent",value:function(){return Xc(this.buffered(),this.duration_)}},{key:"stopTrackingProgress",value:function(){this.clearInterval(this.progressInterval)}},{key:"manualTimeUpdatesOn",value:function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}},{key:"manualTimeUpdatesOff",value:function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}},{key:"trackCurrentTime",value:function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}},{key:"stopTrackingCurrentTime",value:function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}},{key:"dispose",value:function(){this.clearTracks(Ad.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),n(e,"dispose",this,3)([])}},{key:"clearTracks",value:function(e){var t=this;(e=[].concat(e)).forEach(function(e){for(var n=t["".concat(e,"Tracks")]()||[],i=n.length;i--;){var r=n[i];"text"===e&&t.removeRemoteTextTrack(r),n.removeTrack(r)}})}},{key:"cleanupAutoTextTracks",value:function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var n=e[t];this.removeRemoteTextTrack(n)}}},{key:"reset",value:function(){}},{key:"crossOrigin",value:function(){}},{key:"setCrossOrigin",value:function(){}},{key:"error",value:function(e){return void 0!==e&&(this.error_=new Kc(e),this.trigger("error")),this.error_}},{key:"played",value:function(){return this.hasStarted_?Fc(0,0):Fc()}},{key:"play",value:function(){}},{key:"setScrubbing",value:function(e){}},{key:"scrubbing",value:function(){}},{key:"setCurrentTime",value:function(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}},{key:"initTrackListeners",value:function(){var e=this;Ad.names.forEach(function(t){var n=Ad[t],i=function(){e.trigger("".concat(t,"trackchange"))},r=e[n.getterName]();r.addEventListener("removetrack",i),r.addEventListener("addtrack",i),e.on("dispose",function(){r.removeEventListener("removetrack",i),r.removeEventListener("addtrack",i)})})}},{key:"addWebVttScript_",value:function(){var e=this;if(!wn.WebVTT)if(Ln.body.contains(this.el())){if(!this.options_["vtt.js"]&&Nu(Bi)&&Object.keys(Bi).length>0)return void this.trigger("vttjsloaded");var t=Ln.createElement("script");t.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",t.onload=function(){e.trigger("vttjsloaded")},t.onerror=function(){e.trigger("vttjserror")},this.on("dispose",function(){t.onload=null,t.onerror=null}),wn.WebVTT=!0,this.el().parentNode.appendChild(t)}else this.ready(this.addWebVttScript_)}},{key:"emulateTextTracks",value:function(){var e=this,t=this.textTracks(),n=this.remoteTextTracks(),i=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};n.on("addtrack",i),n.on("removetrack",r),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e<t.length;e++){var n=t[e];n.removeEventListener("cuechange",a),"showing"===n.mode&&n.addEventListener("cuechange",a)}};s(),t.addEventListener("change",s),t.addEventListener("addtrack",s),t.addEventListener("removetrack",s),this.on("dispose",function(){n.off("addtrack",i),n.off("removetrack",r),t.removeEventListener("change",s),t.removeEventListener("addtrack",s),t.removeEventListener("removetrack",s);for(var e=0;e<t.length;e++){t[e].removeEventListener("cuechange",a)}})}},{key:"addTextTrack",value:function(e,t,n){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=e.textTracks();r.kind=t,n&&(r.label=n),i&&(r.language=i),r.tech=e;var s=new xd.text.TrackClass(r);return a.addTrack(s),s}(this,e,t,n)}},{key:"createRemoteTextTrack",value:function(e){var t=Uu(e,{tech:this});return new Id.remoteTextEl.TrackClass(t)}},{key:"addRemoteTextTrack",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,i=this.createRemoteTextTrack(t);return"boolean"!=typeof n&&(n=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),!1===n&&this.ready(function(){return e.autoRemoteTextTracks_.addTrack(i.track)}),i}},{key:"removeRemoteTextTrack",value:function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}},{key:"getVideoPlaybackQuality",value:function(){return{}}},{key:"requestPictureInPicture",value:function(){return Promise.reject()}},{key:"disablePictureInPicture",value:function(){return!0}},{key:"setDisablePictureInPicture",value:function(){}},{key:"requestVideoFrameCallback",value:function(e){var t=this,n=ic();return!this.isReady_||this.paused()?(this.queuedHanders_.add(n),this.one("playing",function(){t.queuedHanders_.has(n)&&(t.queuedHanders_.delete(n),e())})):this.requestNamedAnimationFrame(n,e),n}},{key:"cancelVideoFrameCallback",value:function(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}},{key:"setPoster",value:function(){}},{key:"playsinline",value:function(){}},{key:"setPlaysinline",value:function(){}},{key:"overrideNativeAudioTracks",value:function(e){}},{key:"overrideNativeVideoTracks",value:function(e){}},{key:"canPlayType",value:function(e){return""}}],[{key:"canPlayType",value:function(e){return""}},{key:"canPlaySource",value:function(t,n){return e.canPlayType(t.type)}},{key:"isTech",value:function(t){return t.prototype instanceof e||t instanceof e||t===e}},{key:"registerTech",value:function(t,n){if(e.techs_||(e.techs_={}),!e.isTech(n))throw new Error("Tech ".concat(t," must be a Tech"));if(!e.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!e.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return t=Oc(t),e.techs_[t]=n,e.techs_[Rc(t)]=n,"Tech"!==t&&e.defaultTechOrder_.push(t),n}},{key:"getTech",value:function(t){if(t)return e.techs_&&e.techs_[t]?e.techs_[t]:(t=Oc(t),wn&&wn.videojs&&wn.videojs[t]?(Iu.warn("The ".concat(t," tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)")),wn.videojs[t]):void 0)}}])}();xd.names.forEach(function(e){var t=xd[e];Ld.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),Ld.prototype.featuresVolumeControl=!0,Ld.prototype.featuresMuteControl=!0,Ld.prototype.featuresFullscreenResize=!1,Ld.prototype.featuresPlaybackRate=!1,Ld.prototype.featuresProgressEvents=!1,Ld.prototype.featuresSourceset=!1,Ld.prototype.featuresTimeupdateEvents=!1,Ld.prototype.featuresNativeTextTracks=!1,Ld.prototype.featuresVideoFrameCallback=!1,Ld.withSourceHandlers=function(e){e.registerSourceHandler=function(t,n){var i=e.sourceHandlers;i||(i=e.sourceHandlers=[]),void 0===n&&(n=i.length),i.splice(n,0,t)},e.canPlayType=function(t){for(var n,i=e.sourceHandlers||[],r=0;r<i.length;r++)if(n=i[r].canPlayType(t))return n;return""},e.selectSourceHandler=function(t,n){for(var i=e.sourceHandlers||[],r=0;r<i.length;r++)if(i[r].canHandleSource(t,n))return i[r];return null},e.canPlaySource=function(t,n){var i=e.selectSourceHandler(t,n);return i?i.canHandleSource(t,n):""};["seekable","seeking","duration"].forEach(function(e){var t=this[e];"function"==typeof t&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},e.prototype),e.prototype.setSource=function(t){var n=e.selectSourceHandler(t,this.options_);n||(e.nativeSourceHandler?n=e.nativeSourceHandler:Iu.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),n!==e.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=n.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},e.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)}},Mc.registerComponent("Tech",Ld),Ld.registerTech("Tech",Ld),Ld.defaultTechOrder_=[];var Dd={},Pd={},Rd={};function Od(e,t,n){e.setTimeout(function(){return Fd(t,Dd[t.type],n,e)},1)}function Nd(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r="call"+Oc(n),a=e.reduce(jd(r),i),s=a===Rd,o=s?null:t[n](a);return function(e,t,n,i){for(var r=e.length-1;r>=0;r--){var a=e[r];a[t]&&a[t](i,n)}}(e,n,o,s),o}var Ud={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Md={setCurrentTime:1,setMuted:1,setVolume:1},Bd={play:1,pause:1};function jd(e){return function(t,n){return t===Rd?Rd:n[e]?n[e](t):t}}function Fd(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=A(e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[])||T(e)||E(e)||w(),o=s[0],u=C(s).slice(1);if("string"==typeof o)Fd(t,Dd[o],n,i,r,a);else if(o){var l=function(e,t){var n=Pd[e.id()],i=null;if(null==n)return i=t(e),Pd[e.id()]=[[t,i]],i;for(var r=0;r<n.length;r++){var a=S(n[r],2),s=a[0],o=a[1];s===t&&(i=o)}return null===i&&(i=t(e),n.push([t,i])),i}(i,o);if(!l.setSource)return r.push(l),Fd(t,u,n,i,r,a);l.setSource(Object.assign({},t),function(e,s){if(e)return Fd(t,u,n,i,r,a);r.push(l),Fd(s,t.type===s.type?u:Dd[s.type],n,i,r,a)})}else u.length?Fd(t,u,n,i,r,a):a?n(t,r):Fd(t,Dd["*"],n,i,r,!0)}var qd={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"},Vd=function(){var e=yd(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"");return qd[e.toLowerCase()]||""},Hd=function(e){if(Array.isArray(e)){var t=[];e.forEach(function(e){e=Hd(e),Array.isArray(e)?t=t.concat(e):Ou(e)&&t.push(e)}),e=t}else e="string"==typeof e&&e.trim()?[zd({src:e})]:Ou(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[zd(e)]:[];return e};function zd(e){if(!e.type){var t=Vd(e.src);t&&(e.type=t)}return e}var Wd=al?10009:sl?461:8,Gd={codes:{play:415,pause:19,ff:417,rw:412,back:Wd},names:I({415:"play",19:"pause",417:"ff",412:"rw"},Wd,"back"),isEventKey:function(e,t){return t=t.toLowerCase(),!(!this.names[e.keyCode]||this.names[e.keyCode]!==t)},getEventName:function(e){if(this.names[e.keyCode])return this.names[e.keyCode];if(this.codes[e.code]){var t=this.codes[e.code];return this.names[t]}return null}},Xd=function(){function e(t){var n;return g(this,e),(n=c(this,e)).player_=t,n.focusableComponents=[],n.isListening_=!1,n.isPaused_=!1,n.onKeyDown_=n.onKeyDown_.bind(n),n.lastFocusedComponent_=null,n}return f(e,bc),y(e,[{key:"start",value:function(){var e=this;this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",function(){e.focus(e.updateFocusableComponents()[0])}),this.player_.on("modalclose",function(){e.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",function(){e.updateFocusableComponents(),e.focusableComponents.length&&(e.focusableComponents.length>1?e.focusableComponents[1].focus():e.focusableComponents[0].focus())}))}},{key:"stop",value:function(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}},{key:"onKeyDown_",value:function(e){var t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();var n=t.key.substring(5).toLowerCase();this.move(n)}else if(Gd.isEventKey(t,"play")||Gd.isEventKey(t,"pause")||Gd.isEventKey(t,"ff")||Gd.isEventKey(t,"rw")){t.preventDefault();var i=Gd.getEventName(t);this.performMediaAction_(i)}else Gd.isEventKey(t,"Back")&&e.target&&"function"==typeof e.target.closeable&&e.target.closeable()&&(t.preventDefault(),e.target.close())}},{key:"performMediaAction_",value:function(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()+5);break;case"rw":this.userSeek_(this.player_.currentTime()-5)}}},{key:"userSeek_",value:function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}},{key:"pause",value:function(){this.isPaused_=!0}},{key:"resume",value:function(){this.isPaused_=!1}},{key:"handlePlayerBlur_",value:function(e){var t=e.relatedTarget,n=null,i=this.getCurrentComponent(e.target);t&&(n=Boolean(t.closest(".video-js")),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(e.currentTarget.contains(e.relatedTarget)||n)&&t||(i&&"CloseButton"===i.name()?this.refocusComponent():(this.pause(),i&&i.el()&&(this.lastFocusedComponent_=i)))}},{key:"handlePlayerFocus_",value:function(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}},{key:"updateFocusableComponents",value:function(){var e=this,t=this.player_,n=[];function i(e){var t,r=_(e);try{for(r.s();!(t=r.n()).done;){var a=t.value;a.hasOwnProperty("el_")&&a.getIsFocusable()&&a.getIsAvailableToBeFocused(a.el())&&n.push(a),a.hasOwnProperty("children_")&&a.children_.length>0&&i(a.children_)}}catch(s){r.e(s)}finally{r.f()}}return t.children_.forEach(function(t){if(t.hasOwnProperty("el_")){if(t.getIsFocusable&&t.getIsAvailableToBeFocused&&t.getIsFocusable()&&t.getIsAvailableToBeFocused(t.el()))return void n.push(t);t.hasOwnProperty("children_")&&t.children_.length>0?i(t.children_):t.hasOwnProperty("items")&&t.items.length>0?i(t.items):e.findSuitableDOMChild(t)&&n.push(t)}if("ErrorDisplay"===t.name_&&t.opened_){var r=t.el_.querySelector(".vjs-errors-ok-button-container");if(r)r.querySelectorAll("button").forEach(function(e,t){n.push({name:function(){return"ModalButton"+(t+1)},el:function(){return e},getPositions:function(){var t=e.getBoundingClientRect();return{boundingClientRect:{x:t.x,y:t.y,width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left},center:{x:t.left+t.width/2,y:t.top+t.height/2,width:0,height:0,top:t.top+t.height/2,right:t.left+t.width/2,bottom:t.top+t.height/2,left:t.left+t.width/2}}},getIsAvailableToBeFocused:function(){return!0},getIsFocusable:function(e){return!0},focus:function(){return e.focus()}})})}}),this.focusableComponents=n,this.focusableComponents}},{key:"findSuitableDOMChild",value:function(e){return e.el()?function t(n){if(e.getIsFocusable(n)&&e.getIsAvailableToBeFocused(n))return n;for(var i=0;i<n.children.length;i++){var r=t(n.children[i]);if(r)return r}return null}(e.el()):null}},{key:"getCurrentComponent",value:function(e){this.updateFocusableComponents();var t=e||document.activeElement;if(this.focusableComponents.length){var n,i=_(this.focusableComponents);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(r.el()===t)return r}}catch(a){i.e(a)}finally{i.f()}}}},{key:"add",value:function(e){var t=b(this.focusableComponents);e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}},{key:"remove",value:function(e){for(var t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name())return this.focusableComponents.splice(t,1),void this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}},{key:"clear",value:function(){this.focusableComponents.length>0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}},{key:"move",value:function(e){var t=this,n=this.getCurrentComponent();if(n){var i=n.getPositions(),r=this.focusableComponents.filter(function(r){return r!==n&&t.isInDirection_(i.boundingClientRect,r.getPositions().boundingClientRect,e)}),a=this.findBestCandidate_(i.center,r,e);a?this.focus(a):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:n})}}},{key:"findBestCandidate_",value:function(e,t,n){var i,r=1/0,a=null,s=_(t);try{for(s.s();!(i=s.n()).done;){var o=i.value,u=o.getPositions().center,l=this.calculateDistance_(e,u,n);l<r&&(r=l,a=o)}}catch(c){s.e(c)}finally{s.f()}return a}},{key:"isInDirection_",value:function(e,t,n){switch(n){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}},{key:"refocusComponent",value:function(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(var e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name())return void this.focus(this.focusableComponents[e])}else this.focus(this.updateFocusableComponents()[0])}},{key:"focus",value:function(e){"object"===k(e)&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}},{key:"calculateDistance_",value:function(e,t,n){var i,r=Math.abs(e.x-t.x),a=Math.abs(e.y-t.y);switch(n){case"right":case"left":i=r+100*a;break;case"up":i=2*a+.5*r;break;case"down":i=5*a+r;break;default:i=r+a}return i}},{key:"searchForTrackSelect_",value:function(){var e,t=_(this.updateFocusableComponents());try{for(t.s();!(e=t.n()).done;){var n=e.value;if("TextTrackSelect"===n.constructor.name){this.focus(n);break}}}catch(i){t.e(i)}finally{t.f()}}}])}(),Kd=function(){function e(t,n,i){var r;if(g(this,e),r=c(this,e,[t,Uu({createEl:!1},n),i]),n.playerOptions.sources&&0!==n.playerOptions.sources.length)t.src(n.playerOptions.sources);else for(var a=0,s=n.playerOptions.techOrder;a<s.length;a++){var o=Oc(s[a]),u=Ld.getTech(o);if(o||(u=Mc.getComponent(o)),u&&u.isSupported()){t.loadTech_(o);break}}return r}return f(e,Mc),y(e)}();Mc.registerComponent("MediaLoader",Kd);var Yd=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).options_.controlText&&i.controlText(i.options_.controlText),i.handleMouseOver_=function(e){return i.handleMouseOver(e)},i.handleMouseOut_=function(e){return i.handleMouseOut(e)},i.handleClick_=function(e){return i.handleClick(e)},i.handleKeyDown_=function(e){return i.handleKeyDown(e)},i.emitTapEvents(),i.enable(),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&Iu.error("Creating a ClickableComponent with an HTML element of ".concat(e," is not supported; use a Button instead.")),n=Object.assign({role:"button"},n),this.tabIndex_=t.tabIndex;var i=_l(e,t,n);return this.player_.options_.experimentalSvgIcons||i.appendChild(_l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(i),i}},{key:"dispose",value:function(){this.controlTextEl_=null,n(e,"dispose",this,3)([])}},{key:"createControlTextEl",value:function(e){return this.controlTextEl_=_l("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}},{key:"controlText",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.el();if(void 0===e)return this.controlText_||"Need Text";var n=this.localize(e);this.controlText_=e,bl(this.controlTextEl_,n),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",n)}},{key:"buildCSSClass",value:function(){return"vjs-control vjs-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"enable",value:function(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),void 0!==this.tabIndex_&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}},{key:"disable",value:function(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),void 0!==this.tabIndex_&&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_)}},{key:"handleLanguagechange",value:function(){this.controlText(this.controlText_)}},{key:"handleClick",value:function(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}},{key:"handleKeyDown",value:function(t){" "===t.key||"Enter"===t.key?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):n(e,"handleKeyDown",this,3)([t])}}])}();Mc.registerComponent("ClickableComponent",Yd);var Qd=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).update(),i.update_=function(e){return i.update(e)},t.on("posterchange",i.update_),i}return f(e,Yd),y(e,[{key:"dispose",value:function(){this.player().off("posterchange",this.update_),n(e,"dispose",this,3)([])}},{key:"createEl",value:function(){return _l("div",{className:"vjs-poster"})}},{key:"crossOrigin",value:function(e){if(void 0===e)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;null===e||"anonymous"===e||"use-credentials"===e?this.$("img")&&(this.$("img").crossOrigin=e):this.player_.log.warn('crossOrigin must be null, "anonymous" or "use-credentials", given "'.concat(e,'"'))}},{key:"update",value:function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}},{key:"setSrc",value:function(e){e?(this.$("img")||this.el_.appendChild(_l("picture",{className:"vjs-poster",tabIndex:-1},{},_l("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e):this.el_.textContent=""}},{key:"handleClick",value:function(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Qc(this.player_.play()):this.player_.pause())}}])}();Qd.prototype.crossorigin=Qd.prototype.crossOrigin,Mc.registerComponent("PosterImage",Qd);var $d="#222",Jd="#ccc",Zd={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 eh(e,t){var n;if(4===e.length)n=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");n=e.slice(1)}return"rgba("+parseInt(n.slice(0,2),16)+","+parseInt(n.slice(2,4),16)+","+parseInt(n.slice(4,6),16)+","+t+")"}function th(e,t,n){try{e.style[t]=n}catch(vy){return}}function nh(e){return e?"".concat(e,"px"):""}var ih=function(){function e(t,n,i){var r;g(this,e),r=c(this,e,[t,n,i]);var a=function(e){r.updateDisplayOverlay(),r.updateDisplay(e)};return t.on("loadstart",function(e){return r.toggleDisplay(e)}),t.on("texttrackchange",function(e){return r.updateDisplay(e)}),t.on("loadedmetadata",function(e){r.updateDisplayOverlay(),r.preselectTrack(e)}),t.ready(gc(r,function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",a),t.on("playerresize",a);var e=wn.screen.orientation||wn,n=wn.screen.orientation?"change":"orientationchange";e.addEventListener(n,a),t.on("dispose",function(){return e.removeEventListener(n,a)});for(var i=this.options_.playerOptions.tracks||[],r=0;r<i.length;r++)this.player_.addRemoteTextTrack(i[r],!0);this.preselectTrack()}})),r}return f(e,Mc),y(e,[{key:"preselectTrack",value:function(){for(var e,t,n,i={captions:1,subtitles:1},r=this.player_.textTracks(),a=this.player_.cache_.selectedLanguage,s=0;s<r.length;s++){var o=r[s];a&&a.enabled&&a.language&&a.language===o.language&&o.kind in i?o.kind===a.kind?n=o:n||(n=o):a&&!a.enabled?(n=null,e=null,t=null):o.default&&("descriptions"!==o.kind||e?o.kind in i&&!t&&(t=o):e=o)}n?n.mode="showing":t?t.mode="showing":e&&(e.mode="showing")}},{key:"toggleDisplay",value:function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}},{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"}])}},{key:"clearDisplay",value:function(){"function"==typeof wn.WebVTT&&wn.WebVTT.processCues(wn,[],this.el_)}},{key:"updateDisplay",value:function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var n=[],i=0;i<e.length;++i){var r=e[i];"showing"===r.mode&&n.push(r)}this.updateForTrack(n)}else{for(var a=null,s=null,o=e.length;o--;){var u=e[o];"showing"===u.mode&&("descriptions"===u.kind?a=u:s=u)}if(s?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):a&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(a)),!wn.CSS.supports("inset","10px")){var l=this.el_,c=l.querySelectorAll(".vjs-text-track-cue"),d=this.player_.controlBar.el_.getBoundingClientRect().height,h=this.player_.el_.getBoundingClientRect().height;l.style="",th(l,"position","relative"),th(l,"height",h-d+"px"),th(l,"top","unset"),th(l,"bottom",ol?h+"px":"0px"),c.length>0&&c.forEach(function(e){if(e.style.inset){var t=e.style.inset.split(" ");3===t.length&&Object.assign(e.style,{top:t[0],right:t[1],bottom:t[2],left:"unset"})}})}}}},{key:"updateDisplayOverlay",value:function(){if(this.player_.videoHeight()&&wn.CSS.supports("inset-inline: 10px")){var e=this.player_.currentWidth(),t=this.player_.currentHeight(),n=e/t,i=this.player_.videoWidth()/this.player_.videoHeight(),r=0,a=0;Math.abs(n-i)>.1&&(n>i?r=Math.round((e-t*i)/2):a=Math.round((t-e/i)/2)),th(this.el_,"insetInline",nh(r)),th(this.el_,"insetBlock",nh(a))}}},{key:"updateDisplayState",value:function(e){for(var t=this.player_.textTrackSettings.getValues(),n=e.activeCues,i=n.length;i--;){var r=n[i];if(r){var a=r.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&th(a.firstChild,"color",eh(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&th(a.firstChild,"backgroundColor",eh(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?th(a,"backgroundColor",eh(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?a.firstChild.style.textShadow="2px 2px 3px ".concat($d,", 2px 2px 4px ").concat($d,", 2px 2px 5px ").concat($d):"raised"===t.edgeStyle?a.firstChild.style.textShadow="1px 1px ".concat($d,", 2px 2px ").concat($d,", 3px 3px ").concat($d):"depressed"===t.edgeStyle?a.firstChild.style.textShadow="1px 1px ".concat(Jd,", 0 1px ").concat(Jd,", -1px -1px ").concat($d,", 0 -1px ").concat($d):"uniform"===t.edgeStyle&&(a.firstChild.style.textShadow="0 0 4px ".concat($d,", 0 0 4px ").concat($d,", 0 0 4px ").concat($d,", 0 0 4px ").concat($d))),t.fontPercent&&1!==t.fontPercent){var s=wn.parseFloat(a.style.fontSize);a.style.fontSize=s*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=Zd[t.fontFamily])}}}},{key:"updateForTrack",value:function(e){if(Array.isArray(e)||(e=[e]),"function"==typeof wn.WebVTT&&!e.every(function(e){return!e.activeCues})){for(var t=[],n=0;n<e.length;++n)for(var i=e[n],r=0;r<i.activeCues.length;++r)t.push(i.activeCues[r]);wn.WebVTT.processCues(wn,t,this.el_);for(var a=0;a<e.length;++a){for(var s=e[a],o=0;o<s.activeCues.length;++o){var u=s.activeCues[o].displayState;Sl(u,"vjs-text-track-cue","vjs-text-track-cue-"+(s.language?s.language:a)),s.language&&xl(u,"lang",s.language)}this.player_.textTrackSettings&&this.updateDisplayState(s)}}}}])}();Mc.registerComponent("TextTrackDisplay",ih);var rh=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=this.player_.isAudio(),i=this.localize(t?"Audio Player":"Video Player"),r=_l("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[i])}),a=n(e,"createEl",this,3)(["div",{className:"vjs-loading-spinner",dir:"ltr"}]);return a.appendChild(r),a}},{key:"handleLanguagechange",value:function(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}])}();Mc.registerComponent("LoadingSpinner",rh);var ah=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Yd),y(e,[{key:"createEl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=_l(e="button",t=Object.assign({className:this.buildCSSClass()},t),n=Object.assign({type:"button"},n));return this.player_.options_.experimentalSvgIcons||i.appendChild(_l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(i),i}},{key:"addChild",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.constructor.name;return Iu.warn("Adding an actionable (user controllable) child to a Button (".concat(n,") is not supported; use a ClickableComponent instead.")),Mc.prototype.addChild.call(this,e,t)}},{key:"enable",value:function(){n(e,"enable",this,3)([]),this.el_.removeAttribute("disabled")}},{key:"disable",value:function(){n(e,"disable",this,3)([]),this.el_.setAttribute("disabled","disabled")}},{key:"handleKeyDown",value:function(t){" "!==t.key&&"Enter"!==t.key?n(e,"handleKeyDown",this,3)([t]):t.stopPropagation()}}])}();Mc.registerComponent("Button",ah);var sh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).mouseused_=!1,i.setIcon("play"),i.on("mousedown",function(e){return i.handleMouseDown(e)}),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-big-play-button"}},{key:"handleClick",value:function(e){var t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e)return Qc(t),void(this.player_.tech(!0)&&this.player_.tech(!0).focus());var n=this.player_.getChild("controlBar"),i=n&&n.getChild("playToggle");if(i){var r=function(){return i.focus()};Yc(t)?t.then(r,function(){}):this.setTimeout(r,1)}else this.player_.tech(!0).focus()}},{key:"handleKeyDown",value:function(t){this.mouseused_=!1,n(e,"handleKeyDown",this,3)([t])}},{key:"handleMouseDown",value:function(e){this.mouseused_=!0}}])}();sh.prototype.controlText_="Play Video",Mc.registerComponent("BigPlayButton",sh);var oh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).setIcon("cancel"),i.controlText(n&&n.controlText||i.localize("Close")),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-close-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleClick",value:function(e){this.trigger({type:"close",bubbles:!1})}},{key:"handleKeyDown",value:function(t){"Escape"===t.key?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):n(e,"handleKeyDown",this,3)([t])}}])}();Mc.registerComponent("CloseButton",oh);var uh=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),n=c(this,e,[t,i]),i.replay=void 0===i.replay||i.replay,n.setIcon("play"),n.on(t,"play",function(e){return n.handlePlay(e)}),n.on(t,"pause",function(e){return n.handlePause(e)}),i.replay&&n.on(t,"ended",function(e){return n.handleEnded(e)}),n}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-play-control ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleClick",value:function(e){this.player_.paused()?Qc(this.player_.play()):this.player_.pause()}},{key:"handleSeeked",value:function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}},{key:"handlePlay",value:function(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}},{key:"handlePause",value:function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}},{key:"handleEnded",value:function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",function(e){return t.handleSeeked(e)})}}])}();uh.prototype.controlText_="Play",Mc.registerComponent("PlayToggle",uh);var lh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).on(t,["timeupdate","ended","seeking"],function(e){return i.update(e)}),i.updateTextNode_(),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=this.buildCSSClass(),i=n(e,"createEl",this,3)(["div",{className:"".concat(t," vjs-time-control vjs-control")}]),r=_l("span",{className:"vjs-control-text",textContent:"".concat(this.localize(this.labelText_)," ")},{role:"presentation"});return i.appendChild(r),this.contentEl_=_l("span",{className:"".concat(t,"-display")},{role:"presentation"}),i.appendChild(this.contentEl_),i}},{key:"dispose",value:function(){this.contentEl_=null,this.textNode_=null,n(e,"dispose",this,3)([])}},{key:"update",value:function(e){(this.player_.options_.enableSmoothSeeking||"seeking"!==e.type)&&this.updateContent(e)}},{key:"updateTextNode_",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;t=Wc(t),this.formattedTime_!==t&&(this.formattedTime_=t,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",function(){if(e.contentEl_){var t=e.textNode_;t&&e.contentEl_.firstChild!==t&&(t=null,Iu.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),e.textNode_=Ln.createTextNode(e.formattedTime_),e.textNode_&&(t?e.contentEl_.replaceChild(e.textNode_,t):e.contentEl_.appendChild(e.textNode_))}}))}},{key:"updateContent",value:function(e){}}])}();lh.prototype.labelText_="Time",lh.prototype.controlText_="Time",Mc.registerComponent("TimeDisplay",lh);var ch=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,lh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-current-time"}},{key:"updateContent",value:function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}])}();ch.prototype.labelText_="Current Time",ch.prototype.controlText_="Current Time",Mc.registerComponent("CurrentTimeDisplay",ch);var dh=function(){function e(t,n){var i;g(this,e);var r=function(e){return i.updateContent(e)};return(i=c(this,e,[t,n])).on(t,"durationchange",r),i.on(t,"loadstart",r),i.on(t,"loadedmetadata",r),i}return f(e,lh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-duration"}},{key:"updateContent",value:function(e){var t=this.player_.duration();this.updateTextNode_(t)}}])}();dh.prototype.labelText_="Duration",dh.prototype.controlText_="Duration",Mc.registerComponent("DurationDisplay",dh);var hh=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)(["div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}]),i=n(e,"createEl",this,3)(["div"]),r=n(e,"createEl",this,3)(["span",{textContent:"/"}]);return i.appendChild(r),t.appendChild(i),t}}])}();Mc.registerComponent("TimeDivider",hh);var ph=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).on(t,"durationchange",function(e){return i.updateContent(e)}),i}return f(e,lh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-remaining-time"}},{key:"createEl",value:function(){var t=n(e,"createEl",this,3)([]);return!1!==this.options_.displayNegative&&t.insertBefore(_l("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t}},{key:"updateContent",value:function(e){var t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))}}])}();ph.prototype.labelText_="Remaining Time",ph.prototype.controlText_="Remaining Time",Mc.registerComponent("RemainingTimeDisplay",ph);var fh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).updateShowing(),i.on(i.player(),"durationchange",function(e){return i.updateShowing(e)}),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)(["div",{className:"vjs-live-control vjs-control"}]);return this.contentEl_=_l("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(_l("span",{className:"vjs-control-text",textContent:"".concat(this.localize("Stream Type")," ")})),this.contentEl_.appendChild(Ln.createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t}},{key:"dispose",value:function(){this.contentEl_=null,n(e,"dispose",this,3)([])}},{key:"updateShowing",value:function(e){this.player().duration()===1/0?this.show():this.hide()}}])}();Mc.registerComponent("LiveDisplay",fh);var mh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).updateLiveEdgeStatus(),i.player_.liveTracker&&(i.updateLiveEdgeStatusHandler_=function(e){return i.updateLiveEdgeStatus(e)},i.on(i.player_.liveTracker,"liveedgechange",i.updateLiveEdgeStatusHandler_)),i}return f(e,ah),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)(["button",{className:"vjs-seek-to-live-control vjs-control"}]);return this.setIcon("circle",t),this.textEl_=_l("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t}},{key:"updateLiveEdgeStatus",value:function(){!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"))}},{key:"handleClick",value:function(){this.player_.liveTracker.seekToLiveEdge()}},{key:"dispose",value:function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,n(e,"dispose",this,3)([])}}])}();function gh(e,t,n){return e=Number(e),Math.min(n,Math.max(t,isNaN(e)?t:e))}mh.prototype.controlText_="Seek to live, currently playing live",Mc.registerComponent("SeekToLive",mh);var vh=Object.freeze({__proto__:null,clamp:gh}),yh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).handleMouseDown_=function(e){return i.handleMouseDown(e)},i.handleMouseUp_=function(e){return i.handleMouseUp(e)},i.handleKeyDown_=function(e){return i.handleKeyDown(e)},i.handleClick_=function(e){return i.handleClick(e)},i.handleMouseMove_=function(e){return i.handleMouseMove(e)},i.update_=function(e){return i.update(e)},i.bar=i.getChild(i.options_.barName),i.vertical(!!i.options_.vertical),i.enable(),i}return f(e,Mc),y(e,[{key:"enabled",value:function(){return this.enabled_}},{key:"enable",value:function(){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)}},{key:"disable",value:function(){if(this.enabled()){var 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}}},{key:"createEl",value:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.className=i.className+" vjs-slider",i=Object.assign({tabIndex:0},i),r=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},r),n(e,"createEl",this,3)([t,i,r])}},{key:"handleMouseDown",value:function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Qu||e.preventDefault(),Dl(),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)}},{key:"handleMouseMove",value:function(e){}},{key:"handleMouseUp",value:function(e){var t=this.bar.el_.ownerDocument;Pl(),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()}},{key:"update",value:function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",function(){var n=e.vertical()?"height":"width";e.bar.el().style[n]=(100*t).toFixed(2)+"%"})),t}}},{key:"getProgress",value:function(){return Number(gh(this.getPercent(),0,1).toFixed(4))}},{key:"calculateDistance",value:function(e){var t=Nl(this.el_,e);return this.vertical()?t.y:t.x}},{key:"handleKeyDown",value:function(t){var i=this.options_.playerOptions.spatialNavigation,r=i&&i.enabled,a=i&&i.horizontalSeek;r?a&&"ArrowLeft"===t.key||!a&&"ArrowDown"===t.key?(t.preventDefault(),t.stopPropagation(),this.stepBack()):a&&"ArrowRight"===t.key||!a&&"ArrowUp"===t.key?(t.preventDefault(),t.stopPropagation(),this.stepForward()):n(e,"handleKeyDown",this,3)([t]):"ArrowLeft"===t.key||"ArrowDown"===t.key?(t.preventDefault(),t.stopPropagation(),this.stepBack()):"ArrowUp"===t.key||"ArrowRight"===t.key?(t.preventDefault(),t.stopPropagation(),this.stepForward()):n(e,"handleKeyDown",this,3)([t])}},{key:"handleClick",value:function(e){e.stopPropagation(),e.preventDefault()}},{key:"vertical",value:function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}])}();Mc.registerComponent("Slider",yh);var _h=function(e,t){return gh(e/t*100,0,100).toFixed(2)+"%"},bh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).partEls_=[],i.on(t,"progress",function(e){return i.update(e)}),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)(["div",{className:"vjs-load-progress"}]),i=_l("span",{className:"vjs-control-text"}),r=_l("span",{textContent:this.localize("Loaded")}),a=Ln.createTextNode(": ");return this.percentageEl_=_l("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(i),i.appendChild(r),i.appendChild(a),i.appendChild(this.percentageEl_),t}},{key:"dispose",value:function(){this.partEls_=null,this.percentageEl_=null,n(e,"dispose",this,3)([])}},{key:"update",value:function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",function(){var e=t.player_.liveTracker,n=t.player_.buffered(),i=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),a=t.partEls_,s=_h(r,i);t.percent_!==s&&(t.el_.style.width=s,bl(t.percentageEl_,s),t.percent_=s);for(var o=0;o<n.length;o++){var u=n.start(o),l=n.end(o),c=a[o];c||(c=t.el_.appendChild(_l()),a[o]=c),c.dataset.start===u&&c.dataset.end===l||(c.dataset.start=u,c.dataset.end=l,c.style.left=_h(u,r),c.style.width=_h(l-u,r))}for(var d=a.length;d>n.length;d--)t.el_.removeChild(a[d-1]);a.length=n.length})}}])}();Mc.registerComponent("LoadProgressBar",bh);var Th=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).update=vc(gc(i,i.update),mc),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"}])}},{key:"update",value:function(e,t,n){var i=Ol(this.el_),r=Rl(this.player_.el()),a=e.width*t;if(r&&i){var s=e.left-r.left+a,o=e.width-a+(r.right-e.right);o||(o=e.width-a,s=a);var u=i.width/2;s<u?u+=u-s:o<u&&(u=o),u<0?u=0:u>i.width&&(u=i.width),u=Math.round(u),this.el_.style.right="-".concat(u,"px"),this.write(n)}}},{key:"write",value:function(e){bl(this.el_,e)}},{key:"updateTime",value:function(e,t,n,i){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",function(){var a,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),u=o-t*o;a=(u<1?"":"-")+Wc(u,o)}else a=Wc(n,s);r.update(e,t,a),i&&i()})}}])}();Mc.registerComponent("TimeTooltip",Th);var kh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).setIcon("circle"),i.update=vc(gc(i,i.update),mc),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"}])}},{key:"update",value:function(e,t){var n=this.getChild("timeTooltip");if(n){var i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,i)}}}])}();kh.prototype.options_={children:[]},dl||Gu||kh.prototype.options_.children.push("timeTooltip"),Mc.registerComponent("PlayProgressBar",kh);var Sh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).update=vc(gc(i,i.update),mc),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-mouse-display"}])}},{key:"update",value:function(e,t){var n=this,i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,function(){n.el_.style.left="".concat(e.width*t,"px")})}}])}();Sh.prototype.options_={children:["timeTooltip"]},Mc.registerComponent("MouseTimeDisplay",Sh);var wh=function(){function e(t,n){var i;g(this,e),(n=Uu(e.prototype.options_,n)).children=b(n.children);var r=t.options_.disableSeekWhileScrubbingOnMobile&&(dl||Gu);return(!dl&&!Gu||r)&&n.children.splice(1,0,"mouseTimeDisplay"),(i=c(this,e,[t,n])).shouldDisableSeekWhileScrubbingOnMobile_=r,i.pendingSeekTime_=null,i.setEventHandlers_(),i}return f(e,yh),y(e,[{key:"setEventHandlers_",value:function(){var e=this;this.update_=gc(this,this.update),this.update=vc(this.update_,mc),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_=function(t){return e.enableInterval_(t)},this.disableIntervalHandler_=function(t){return e.disableInterval_(t)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in Ln&&"visibilityState"in Ln&&this.on(Ln,"visibilitychange",this.toggleVisibility_)}},{key:"toggleVisibility_",value:function(e){"hidden"===Ln.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())}},{key:"enableInterval_",value:function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,mc))}},{key:"disableInterval_",value:function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}},{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")}])}},{key:"update",value:function(t){var i=this;if("hidden"!==Ln.visibilityState){var r=n(e,"update",this,3)([]);return this.requestNamedAnimationFrame("SeekBar#update",function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,n=i.player_.duration();t&&t.isLive()&&(n=i.player_.liveTracker.liveCurrentTime()),i.percent_!==r&&(i.el_.setAttribute("aria-valuenow",(100*r).toFixed(2)),i.percent_=r),i.currentTime_===e&&i.duration_===n||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[Wc(e,n),Wc(n,n)],"{1} of {2}")),i.currentTime_=e,i.duration_=n),i.bar&&i.bar.update(Rl(i.el()),i.getProgress())}),r}}},{key:"userSeek_",value:function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}},{key:"getCurrentTime_",value:function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}},{key:"getPercent",value:function(){if(this.pendingSeekTime_)return this.pendingSeekTime_/this.player_.duration();var e,t=this.getCurrentTime_(),n=this.player_.liveTracker;return n&&n.isLive()?(e=(t-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e}},{key:"handleMouseDown",value:function(t){ql(t)&&(t.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbingOnMobile_||this.player_.pause(),n(e,"handleMouseDown",this,3)([t]))}},{key:"handleMouseMove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(ql(e)&&!isNaN(this.player_.duration())){var n;t||this.player_.scrubbing()||this.player_.scrubbing(!0);var i=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){if(i>=.99)return void r.seekToLiveEdge();var a=r.seekableStart(),s=r.liveCurrentTime();if((n=a+i*r.liveWindow())>=s&&(n=s),n<=a&&(n=a+.1),n===1/0)return}else(n=i*this.player_.duration())===this.player_.duration()&&(n-=.1);this.shouldDisableSeekWhileScrubbingOnMobile_?this.pendingSeekTime_=n:this.userSeek_(n),this.player_.options_.enableSmoothSeeking&&this.update()}}},{key:"enable",value:function(){n(e,"enable",this,3)([]);var t=this.getChild("mouseTimeDisplay");t&&t.show()}},{key:"disable",value:function(){n(e,"disable",this,3)([]);var t=this.getChild("mouseTimeDisplay");t&&t.hide()}},{key:"handleMouseUp",value:function(t){n(e,"handleMouseUp",this,3)([t]),t&&t.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?Qc(this.player_.play()):this.update_()}},{key:"stepForward",value:function(){this.userSeek_(this.player_.currentTime()+5)}},{key:"stepBack",value:function(){this.userSeek_(this.player_.currentTime()-5)}},{key:"handleAction",value:function(e){this.player_.paused()?this.player_.play():this.player_.pause()}},{key:"handleKeyDown",value:function(t){var i=this.player_.liveTracker;if(" "===t.key||"Enter"===t.key)t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if("Home"===t.key)t.preventDefault(),t.stopPropagation(),this.userSeek_(0);else if("End"===t.key)t.preventDefault(),t.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(t.key)){t.preventDefault(),t.stopPropagation();var r=.1*parseInt(t.key,10);i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*r):this.userSeek_(this.player_.duration()*r)}else"PageDown"===t.key?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):"PageUp"===t.key?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):n(e,"handleKeyDown",this,3)([t])}},{key:"dispose",value:function(){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 Ln&&"visibilityState"in Ln&&this.off(Ln,"visibilitychange",this.toggleVisibility_),n(e,"dispose",this,3)([])}}])}();wh.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},Mc.registerComponent("SeekBar",wh);var Eh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).handleMouseMove=vc(gc(i,i.handleMouseMove),mc),i.throttledHandleMouseSeek=vc(gc(i,i.handleMouseSeek),mc),i.handleMouseUpHandler_=function(e){return i.handleMouseUp(e)},i.handleMouseDownHandler_=function(e){return i.handleMouseDown(e)},i.enable(),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-progress-control vjs-control"}])}},{key:"handleMouseMove",value:function(e){var t=this.getChild("seekBar");if(t){var n=t.getChild("playProgressBar"),i=t.getChild("mouseTimeDisplay");if(n||i){var r=t.el(),a=Ol(r),s=Nl(r,e).x;s=gh(s,0,1),i&&i.update(a,s),n&&n.update(a,t.getProgress())}}}},{key:"handleMouseSeek",value:function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)}},{key:"enabled",value:function(){return this.enabled_}},{key:"disable",value:function(){if(this.children().forEach(function(e){return 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())){var e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Qc(this.player_.play())}}},{key:"enable",value:function(){this.children().forEach(function(e){return 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)}},{key:"removeListenersAddedOnMousedownAndTouchstart",value:function(){var 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_)}},{key:"handleMouseDown",value:function(e){var t=this.el_.ownerDocument,n=this.getChild("seekBar");n&&n.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}},{key:"handleMouseUp",value:function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}])}();Eh.prototype.options_={children:["seekBar"]},Mc.registerComponent("ProgressControl",Eh);var Ch=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).setIcon("picture-in-picture-enter"),i.on(t,["enterpictureinpicture","leavepictureinpicture"],function(e){return i.handlePictureInPictureChange(e)}),i.on(t,["disablepictureinpicturechanged","loadedmetadata"],function(e){return i.handlePictureInPictureEnabledChange(e)}),i.on(t,["loadedmetadata","audioonlymodechange","audiopostermodechange"],function(){return i.handlePictureInPictureAudioModeChange()}),i.disable(),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-picture-in-picture-control vjs-hidden ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handlePictureInPictureAudioModeChange",value:function(){"audio"===this.player_.currentType().substring(0,5)||this.player_.audioPosterMode()||this.player_.audioOnlyMode()?(this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()):this.show()}},{key:"handlePictureInPictureEnabledChange",value:function(){Ln.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in wn?this.enable():this.disable()}},{key:"handlePictureInPictureChange",value:function(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()}},{key:"handleClick",value:function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}},{key:"show",value:function(){"function"==typeof Ln.exitPictureInPicture&&n(e,"show",this,3)([])}}])}();Ch.prototype.controlText_="Picture-in-Picture",Mc.registerComponent("PictureInPictureToggle",Ch);var Ah=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).setIcon("fullscreen-enter"),i.on(t,"fullscreenchange",function(e){return i.handleFullscreenChange(e)}),!1===Ln[t.fsApi_.fullscreenEnabled]&&i.disable(),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-fullscreen-control ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleFullscreenChange",value:function(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}},{key:"handleClick",value:function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}])}();Ah.prototype.controlText_="Fullscreen",Mc.registerComponent("FullscreenToggle",Ah);var Ih=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)(["div",{className:"vjs-volume-level"}]);return this.setIcon("circle",t),t.appendChild(n(e,"createEl",this,3)(["span",{className:"vjs-control-text"}])),t}}])}();Mc.registerComponent("VolumeLevel",Ih);var xh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).update=vc(gc(i,i.update),mc),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"}])}},{key:"update",value:function(e,t,n,i){if(!n){var r=Rl(this.el_),a=Rl(this.player_.el()),s=e.width*t;if(!a||!r)return;var o=e.left-a.left+s,u=e.width-s+(a.right-e.right),l=r.width/2;o<l?l+=l-o:u<l&&(l=u),l<0?l=0:l>r.width&&(l=r.width),this.el_.style.right="-".concat(l,"px")}this.write("".concat(i,"%"))}},{key:"write",value:function(e){bl(this.el_,e)}},{key:"updateVolume",value:function(e,t,n,i,r){var a=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",function(){a.update(e,t,n,i.toFixed(0)),r&&r()})}}])}();Mc.registerComponent("VolumeLevelTooltip",xh);var Lh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).update=vc(gc(i,i.update),mc),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-mouse-display"}])}},{key:"update",value:function(e,t,n){var i=this,r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,n,r,function(){n?i.el_.style.bottom="".concat(e.height*t,"px"):i.el_.style.left="".concat(e.width*t,"px")})}}])}();Lh.prototype.options_={children:["volumeLevelTooltip"]},Mc.registerComponent("MouseVolumeLevelDisplay",Lh);var Dh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).on("slideractive",function(e){return i.updateLastVolume_(e)}),i.on(t,"volumechange",function(e){return i.updateARIAAttributes(e)}),t.ready(function(){return i.updateARIAAttributes()}),i}return f(e,yh),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"}])}},{key:"handleMouseDown",value:function(t){ql(t)&&n(e,"handleMouseDown",this,3)([t])}},{key:"handleMouseMove",value:function(e){var t=this.getChild("mouseVolumeLevelDisplay");if(t){var n=this.el(),i=Rl(n),r=this.vertical(),a=Nl(n,e);a=gh(a=r?a.y:a.x,0,1),t.update(i,a,r)}ql(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}},{key:"checkMuted",value:function(){this.player_.muted()&&this.player_.muted(!1)}},{key:"getPercent",value:function(){return this.player_.muted()?0:this.player_.volume()}},{key:"stepForward",value:function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}},{key:"stepBack",value:function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}},{key:"updateARIAAttributes",value:function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}},{key:"volumeAsPercentage_",value:function(){return Math.round(100*this.player_.volume())}},{key:"updateLastVolume_",value:function(){var e=this,t=this.player_.volume();this.one("sliderinactive",function(){0===e.player_.volume()&&e.player_.lastVolume_(t)})}}])}();Dh.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},dl||Gu||Dh.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),Dh.prototype.playerEvent="volumechange",Mc.registerComponent("VolumeBar",Dh);var Ph=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),i.vertical=i.vertical||!1,(void 0===i.volumeBar||Nu(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})}(n=c(this,e,[t,i]),t),n.throttledHandleMouseMove=vc(gc(n,n.handleMouseMove),mc),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.on("mousedown",function(e){return n.handleMouseDown(e)}),n.on("touchstart",function(e){return n.handleMouseDown(e)}),n.on("mousemove",function(e){return n.handleMouseMove(e)}),n.on(n.volumeBar,["focus","slideractive"],function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")}),n.on(n.volumeBar,["blur","sliderinactive"],function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")}),n}return f(e,Mc),y(e,[{key:"createEl",value:function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),n(e,"createEl",this,3)(["div",{className:"vjs-volume-control vjs-control ".concat(t)}])}},{key:"handleMouseDown",value:function(e){var 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_)}},{key:"handleMouseUp",value:function(e){var 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_)}},{key:"handleMouseMove",value:function(e){this.volumeBar.handleMouseMove(e)}}])}();Ph.prototype.options_={children:["volumeBar"]},Mc.registerComponent("VolumeControl",Ph);var Rh=function(){function e(t,n){var i;return g(this,e),function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")})}(i=c(this,e,[t,n]),t),i.on(t,["loadstart","volumechange"],function(e){return i.update(e)}),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-mute-control ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleClick",value:function(e){var t=this.player_.volume(),n=this.player_.lastVolume_();if(0===t){var i=n<.1?.1:n;this.player_.volume(i),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}},{key:"update",value:function(e){this.updateIcon_(),this.updateControlText_()}},{key:"updateIcon_",value:function(){var e=this.player_.volume(),t=3;this.setIcon("volume-high"),dl&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||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),wl(this.el_,[0,1,2,3].reduce(function(e,t){return e+"".concat(t?" ":"","vjs-vol-").concat(t)},"")),Sl(this.el_,"vjs-vol-".concat(t))}},{key:"updateControlText_",value:function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}])}();Rh.prototype.controlText_="Mute",Mc.registerComponent("MuteToggle",Rh);var Oh=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),void 0!==i.inline?i.inline=i.inline:i.inline=!0,(void 0===i.volumeControl||Nu(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=c(this,e,[t,i])).handleKeyPressHandler_=function(e){return n.handleKeyPress(e)},n.on(t,["loadstart"],function(e){return n.volumePanelState_(e)}),n.on(n.muteToggle,"keyup",function(e){return n.handleKeyPress(e)}),n.on(n.volumeControl,"keyup",function(e){return n.handleVolumeControlKeyUp(e)}),n.on("keydown",function(e){return n.handleKeyPress(e)}),n.on("mouseover",function(e){return n.handleMouseOver(e)}),n.on("mouseout",function(e){return n.handleMouseOut(e)}),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}return f(e,Mc),y(e,[{key:"sliderActive_",value:function(){this.addClass("vjs-slider-active")}},{key:"sliderInactive_",value:function(){this.removeClass("vjs-slider-active")}},{key:"volumePanelState_",value:function(){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")}},{key:"createEl",value:function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),n(e,"createEl",this,3)(["div",{className:"vjs-volume-panel vjs-control ".concat(t)}])}},{key:"dispose",value:function(){this.handleMouseOut(),n(e,"dispose",this,3)([])}},{key:"handleVolumeControlKeyUp",value:function(e){"Escape"===e.key&&this.muteToggle.focus()}},{key:"handleMouseOver",value:function(e){this.addClass("vjs-hover"),uc(Ln,"keyup",this.handleKeyPressHandler_)}},{key:"handleMouseOut",value:function(e){this.removeClass("vjs-hover"),lc(Ln,"keyup",this.handleKeyPressHandler_)}},{key:"handleKeyPress",value:function(e){"Escape"===e.key&&this.handleMouseOut()}}])}();Oh.prototype.options_={children:["muteToggle","volumeControl"]},Mc.registerComponent("VolumePanel",Oh);var Nh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).validOptions=[5,10,30],i.skipTime=i.getSkipForwardTime(),i.skipTime&&i.validOptions.includes(i.skipTime)?(i.setIcon("forward-".concat(i.skipTime)),i.controlText(i.localize("Skip forward {1} seconds",[i.skipTime.toLocaleString(t.language())])),i.show()):i.hide(),i}return f(e,ah),y(e,[{key:"getSkipForwardTime",value:function(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}},{key:"buildCSSClass",value:function(){return"vjs-skip-forward-".concat(this.getSkipForwardTime()," ").concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleClick",value:function(e){if(!isNaN(this.player_.duration())){var t,n=this.player_.currentTime(),i=this.player_.liveTracker,r=i&&i.isLive()?i.seekableEnd():this.player_.duration();t=n+this.skipTime<=r?n+this.skipTime:r,this.player_.currentTime(t)}}},{key:"handleLanguagechange",value:function(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}])}();Nh.prototype.controlText_="Skip Forward",Mc.registerComponent("SkipForward",Nh);var Uh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).validOptions=[5,10,30],i.skipTime=i.getSkipBackwardTime(),i.skipTime&&i.validOptions.includes(i.skipTime)?(i.setIcon("replay-".concat(i.skipTime)),i.controlText(i.localize("Skip backward {1} seconds",[i.skipTime.toLocaleString(t.language())])),i.show()):i.hide(),i}return f(e,ah),y(e,[{key:"getSkipBackwardTime",value:function(){var e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}},{key:"buildCSSClass",value:function(){return"vjs-skip-backward-".concat(this.getSkipBackwardTime()," ").concat(n(e,"buildCSSClass",this,3)([]))}},{key:"handleClick",value:function(e){var t,n=this.player_.currentTime(),i=this.player_.liveTracker,r=i&&i.isLive()&&i.seekableStart();t=r&&n-this.skipTime<=r?r:n>=this.skipTime?n-this.skipTime:0,this.player_.currentTime(t)}},{key:"handleLanguagechange",value:function(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}])}();Uh.prototype.controlText_="Skip Backward",Mc.registerComponent("SkipBackward",Uh);var Mh=function(){function e(t,n){var i;return g(this,e),i=c(this,e,[t,n]),n&&(i.menuButton_=n.menuButton),i.focusedChild_=-1,i.on("keydown",function(e){return i.handleKeyDown(e)}),i.boundHandleBlur_=function(e){return i.handleBlur(e)},i.boundHandleTapClick_=function(e){return i.handleTapClick(e)},i}return f(e,Mc),y(e,[{key:"addEventListenerForItem",value:function(e){e instanceof Mc&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}},{key:"removeEventListenerForItem",value:function(e){e instanceof Mc&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}},{key:"removeChild",value:function(t){"string"==typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),n(e,"removeChild",this,3)([t])}},{key:"addItem",value:function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)}},{key:"createEl",value:function(){var t=this.options_.contentElType||"ul";this.contentEl_=_l(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=n(e,"createEl",this,3)(["div",{append:this.contentEl_,className:"vjs-menu"}]);return i.appendChild(this.contentEl_),uc(i,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),i}},{key:"dispose",value:function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,n(e,"dispose",this,3)([])}},{key:"handleBlur",value:function(e){var t=e.relatedTarget||Ln.activeElement;if(!this.children().some(function(e){return e.el()===t})){var n=this.menuButton_;n&&n.buttonPressed_&&t!==n.el().firstChild&&n.unpressButton()}}},{key:"handleTapClick",value:function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var n=t.filter(function(t){return t.el()===e.target})[0];if(!n)return;"CaptionSettingsMenuItem"!==n.name()&&this.menuButton_.focus()}}},{key:"handleKeyDown",value:function(e){"ArrowLeft"===e.key||"ArrowDown"===e.key?(e.preventDefault(),e.stopPropagation(),this.stepForward()):"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),e.stopPropagation(),this.stepBack())}},{key:"stepForward",value:function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)}},{key:"stepBack",value:function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)}},{key:"focus",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,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())}}])}();Mc.registerComponent("Menu",Mh);var Bh=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,e),(n=c(this,e,[t,i])).menuButton_=new ah(t,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=ah.prototype.buildCSSClass();n.menuButton_.el_.className=n.buildCSSClass()+" "+r,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0;var a=function(e){return n.handleClick(e)};return n.handleMenuKeyUp_=function(e){return n.handleMenuKeyUp(e)},n.on(n.menuButton_,"tap",a),n.on(n.menuButton_,"click",a),n.on(n.menuButton_,"keydown",function(e){return n.handleKeyDown(e)}),n.on(n.menuButton_,"mouseenter",function(){n.addClass("vjs-hover"),n.menu.show(),uc(Ln,"keyup",n.handleMenuKeyUp_)}),n.on("mouseleave",function(e){return n.handleMouseLeave(e)}),n.on("keydown",function(e){return n.handleSubmenuKeyDown(e)}),n}return f(e,Mc),y(e,[{key:"update",value:function(){var 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"))}},{key:"createMenu",value:function(){var e=new Mh(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=_l("li",{className:"vjs-menu-title",textContent:Oc(this.options_.title),tabIndex:-1}),n=new Mc(this.player_,{el:t});e.addItem(n)}if(this.items=this.createItems(),this.items)for(var i=0;i<this.items.length;i++)e.addItem(this.items[i]);return e}},{key:"createItems",value:function(){}},{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:this.buildWrapperCSSClass()},{}])}},{key:"setIcon",value:function(t){n(e,"setIcon",this,3)([t,this.menuButton_.el_])}},{key:"buildWrapperCSSClass",value:function(){var t="vjs-menu-button";!0===this.options_.inline?t+="-inline":t+="-popup";var i=ah.prototype.buildCSSClass();return"vjs-menu-button ".concat(t," ").concat(i," ").concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildCSSClass",value:function(){var t="vjs-menu-button";return!0===this.options_.inline?t+="-inline":t+="-popup","vjs-menu-button ".concat(t," ").concat(n(e,"buildCSSClass",this,3)([]))}},{key:"controlText",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.menuButton_.el();return this.menuButton_.controlText(e,t)}},{key:"dispose",value:function(){this.handleMouseLeave(),n(e,"dispose",this,3)([])}},{key:"handleClick",value:function(e){this.buttonPressed_?this.unpressButton():this.pressButton()}},{key:"handleMouseLeave",value:function(e){this.removeClass("vjs-hover"),lc(Ln,"keyup",this.handleMenuKeyUp_)}},{key:"focus",value:function(){this.menuButton_.focus()}},{key:"blur",value:function(){this.menuButton_.blur()}},{key:"handleKeyDown",value:function(e){"Escape"===e.key||"Tab"===e.key?(this.buttonPressed_&&this.unpressButton(),"Tab"===!e.key&&(e.preventDefault(),this.menuButton_.focus())):"Up"!==e.key&&("Down"!==e.key||this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)||this.buttonPressed_||(e.preventDefault(),this.pressButton())}},{key:"handleMenuKeyUp",value:function(e){"Escape"!==e.key&&"Tab"!==e.key||this.removeClass("vjs-hover")}},{key:"handleSubmenuKeyPress",value:function(e){this.handleSubmenuKeyDown(e)}},{key:"handleSubmenuKeyDown",value:function(e){"Escape"!==e.key&&"Tab"!==e.key||(this.buttonPressed_&&this.unpressButton(),"Tab"===!e.key&&(e.preventDefault(),this.menuButton_.focus()))}},{key:"pressButton",value:function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),dl&&vl())return;this.menu.focus()}}},{key:"unpressButton",value:function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}},{key:"disable",value:function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}},{key:"enable",value:function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}])}();Mc.registerComponent("MenuButton",Bh);var jh=function(){function e(t,n){var i;g(this,e);var r=n.tracks;if((i=c(this,e,[t,n])).items.length<=1&&i.hide(),!r)return d(i);var a=gc(i,i.update);return r.addEventListener("removetrack",a),r.addEventListener("addtrack",a),r.addEventListener("labelchange",a),i.player_.on("ready",a),i.player_.on("dispose",function(){r.removeEventListener("removetrack",a),r.removeEventListener("addtrack",a),r.removeEventListener("labelchange",a)}),i}return f(e,Bh),y(e)}();Mc.registerComponent("TrackButton",jh);var Fh=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).selectable=n.selectable,i.isSelected_=n.selected||!1,i.multiSelectable=n.multiSelectable,i.selected(i.isSelected_),i.selectable?i.multiSelectable?i.el_.setAttribute("role","menuitemcheckbox"):i.el_.setAttribute("role","menuitemradio"):i.el_.setAttribute("role","menuitem"),i}return f(e,Yd),y(e,[{key:"createEl",value:function(t,i,r){this.nonIconControl=!0;var a=n(e,"createEl",this,3)(["li",Object.assign({className:"vjs-menu-item",tabIndex:-1},i),r]),s=_l("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?a.appendChild(s):a.replaceChild(s,a.querySelector(".vjs-icon-placeholder")),a}},{key:"handleKeyDown",value:function(t){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(t.key)||n(e,"handleKeyDown",this,3)([t])}},{key:"handleClick",value:function(e){this.selected(!0)}},{key:"selected",value:function(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))}}])}();Mc.registerComponent("MenuItem",Fh);var qh=function(){function e(t,n){var i;g(this,e);var r=n.track,a=t.textTracks();n.label=r.label||r.language||"Unknown",n.selected="showing"===r.mode,(i=c(this,e,[t,n])).track=r,i.kinds=(n.kinds||[n.kind||i.track.kind]).filter(Boolean);var s,o=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];i.handleTracksChange.apply(i,t)},u=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];i.handleSelectedLanguageChange.apply(i,t)};(t.on(["loadstart","texttrackchange"],o),a.addEventListener("change",o),a.addEventListener("selectedlanguagechange",u),i.on("dispose",function(){t.off(["loadstart","texttrackchange"],o),a.removeEventListener("change",o),a.removeEventListener("selectedlanguagechange",u)}),void 0===a.onchange)&&i.on(["tap","click"],function(){if("object"!==k(wn.Event))try{s=new wn.Event("change")}catch(e){}s||(s=Ln.createEvent("Event")).initEvent("change",!0,!0),a.dispatchEvent(s)});return i.handleTracksChange(),i}return f(e,Fh),y(e,[{key:"handleClick",value:function(t){var i=this.track,r=this.player_.textTracks();if(n(e,"handleClick",this,3)([t]),r)for(var a=0;a<r.length;a++){var s=r[a];-1!==this.kinds.indexOf(s.kind)&&(s===i?"showing"!==s.mode&&(s.mode="showing"):"disabled"!==s.mode&&(s.mode="disabled"))}}},{key:"handleTracksChange",value:function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)}},{key:"handleSelectedLanguageChange",value:function(e){if("showing"===this.track.mode){var 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}}}},{key:"dispose",value:function(){this.track=null,n(e,"dispose",this,3)([])}}])}();Mc.registerComponent("TextTrackMenuItem",qh);var Vh=function(){function e(t,n){return g(this,e),n.track={player:t,kind:n.kind,kinds:n.kinds,default:!1,mode:"disabled"},n.kinds||(n.kinds=[n.kind]),n.label?n.track.label=n.label:n.track.label=n.kinds.join(" and ")+" off",n.selectable=!0,n.multiSelectable=!1,c(this,e,[t,n])}return f(e,qh),y(e,[{key:"handleTracksChange",value:function(e){for(var t=this.player().textTracks(),n=!0,i=0,r=t.length;i<r;i++){var a=t[i];if(this.options_.kinds.indexOf(a.kind)>-1&&"showing"===a.mode){n=!1;break}}n!==this.isSelected_&&this.selected(n)}},{key:"handleSelectedLanguageChange",value:function(e){for(var t=this.player().textTracks(),n=!0,i=0,r=t.length;i<r;i++){var a=t[i];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&"showing"===a.mode){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})}},{key:"handleLanguagechange",value:function(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),n(e,"handleLanguagechange",this,3)([])}}])}();Mc.registerComponent("OffTextTrackMenuItem",Vh);var Hh=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),n.tracks=t.textTracks(),c(this,e,[t,n])}return f(e,jh),y(e,[{key:"createItems",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qh;this.label_&&(e="".concat(this.label_," off")),t.push(new Vh(this.player_,{kinds:this.kinds_,kind:this.kind_,label:e})),this.hideThreshold_+=1;var i=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<i.length;r++){var a=i[r];if(this.kinds_.indexOf(a.kind)>-1){var s=new n(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-".concat(a.kind,"-menu-item")),t.push(s)}}return t}}])}();Mc.registerComponent("TextTrackButton",Hh);var zh=function(){function e(t,n){var i;g(this,e);var r=n.track,a=n.cue,s=t.currentTime();return n.selectable=!0,n.multiSelectable=!1,n.label=a.text,n.selected=a.startTime<=s&&s<a.endTime,(i=c(this,e,[t,n])).track=r,i.cue=a,i}return f(e,Fh),y(e,[{key:"handleClick",value:function(t){n(e,"handleClick",this,3)([]),this.player_.currentTime(this.cue.startTime)}}])}();Mc.registerComponent("ChaptersTrackMenuItem",zh);var Wh=function(){function e(t,n,i){var r;return g(this,e),(r=c(this,e,[t,n,i])).setIcon("chapters"),r.selectCurrentItem_=function(){r.items.forEach(function(e){e.selected(r.track_.activeCues[0]===e.cue)})},r}return f(e,Hh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-chapters-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-chapters-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}},{key:"update",value:function(t){if(!t||!t.track||"chapters"===t.track.kind){var i=this.findChaptersTrack();i!==this.track_?(this.setTrack(i),n(e,"update",this,3)([])):(!this.items||i&&i.cues&&i.cues.length!==this.items.length)&&n(e,"update",this,3)([])}}},{key:"setTrack",value:function(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){var 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";var n=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);n&&n.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}},{key:"findChaptersTrack",value:function(){for(var e=this.player_.textTracks()||[],t=e.length-1;t>=0;t--){var n=e[t];if(n.kind===this.kind_)return n}}},{key:"getMenuCaption",value:function(){return this.track_&&this.track_.label?this.track_.label:this.localize(Oc(this.kind_))}},{key:"createMenu",value:function(){return this.options_.title=this.getMenuCaption(),n(e,"createMenu",this,3)([])}},{key:"createItems",value:function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var n=0,i=t.length;n<i;n++){var r=t[n],a=new zh(this.player_,{track:this.track_,cue:r});e.push(a)}return e}}])}();Wh.prototype.kind_="chapters",Wh.prototype.controlText_="Chapters",Mc.registerComponent("ChaptersButton",Wh);var Gh=function(){function e(t,n,i){var r;g(this,e),(r=c(this,e,[t,n,i])).setIcon("audio-description");var a=t.textTracks(),s=gc(r,r.handleTracksChange);return a.addEventListener("change",s),r.on("dispose",function(){a.removeEventListener("change",s)}),r}return f(e,Hh),y(e,[{key:"handleTracksChange",value:function(e){for(var t=this.player().textTracks(),n=!1,i=0,r=t.length;i<r;i++){var a=t[i];if(a.kind!==this.kind_&&"showing"===a.mode){n=!0;break}}n?this.disable():this.enable()}},{key:"buildCSSClass",value:function(){return"vjs-descriptions-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-descriptions-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}}])}();Gh.prototype.kind_="descriptions",Gh.prototype.controlText_="Descriptions",Mc.registerComponent("DescriptionsButton",Gh);var Xh=function(){function e(t,n,i){var r;return g(this,e),(r=c(this,e,[t,n,i])).setIcon("subtitles"),r}return f(e,Hh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-subtitles-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-subtitles-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}}])}();Xh.prototype.kind_="subtitles",Xh.prototype.controlText_="Subtitles",Mc.registerComponent("SubtitlesButton",Xh);var Kh=function(){function e(t,n){var i;return g(this,e),n.track={player:t,kind:n.kind,label:n.kind+" settings",selectable:!1,default:!1,mode:"disabled"},n.selectable=!1,n.name="CaptionSettingsMenuItem",(i=c(this,e,[t,n])).addClass("vjs-texttrack-settings"),i.controlText(", opens "+n.kind+" settings dialog"),i}return f(e,qh),y(e,[{key:"handleClick",value:function(e){this.player().getChild("textTrackSettings").open()}},{key:"handleLanguagechange",value:function(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),n(e,"handleLanguagechange",this,3)([])}}])}();Mc.registerComponent("CaptionSettingsMenuItem",Kh);var Yh=function(){function e(t,n,i){var r;return g(this,e),(r=c(this,e,[t,n,i])).setIcon("captions"),r}return f(e,Hh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-captions-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-captions-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}},{key:"createItems",value:function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Kh(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),n(e,"createItems",this,3)([t])}}])}();Yh.prototype.kind_="captions",Yh.prototype.controlText_="Captions",Mc.registerComponent("CaptionsButton",Yh);var Qh=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,qh),y(e,[{key:"createEl",value:function(t,i,r){var a=n(e,"createEl",this,3)([t,i,r]),s=a.querySelector(".vjs-menu-item-text");return"captions"===this.options_.track.kind&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",a):s.appendChild(_l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(_l("span",{className:"vjs-control-text",textContent:" ".concat(this.localize("Captions"))}))),a}}])}();Mc.registerComponent("SubsCapsMenuItem",Qh);var $h=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),(n=c(this,e,[t,i])).label_="subtitles",n.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(n.player_.language_)>-1&&(n.label_="captions",n.setIcon("captions")),n.menuButton_.controlText(Oc(n.label_)),n}return f(e,Hh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-subs-caps-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-subs-caps-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}},{key:"createItems",value:function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Kh(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=n(e,"createItems",this,3)([t,Qh])}}])}();$h.prototype.kinds_=["captions","subtitles"],$h.prototype.controlText_="Subtitles",Mc.registerComponent("SubsCapsButton",$h);var Jh=function(){function e(t,n){var i;g(this,e);var r=n.track,a=t.audioTracks();n.label=r.label||r.language||"Unknown",n.selected=r.enabled,(i=c(this,e,[t,n])).track=r,i.addClass("vjs-".concat(r.kind,"-menu-item"));var s=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];i.handleTracksChange.apply(i,t)};return a.addEventListener("change",s),i.on("dispose",function(){a.removeEventListener("change",s)}),i}return f(e,Fh),y(e,[{key:"createEl",value:function(t,i,r){var a=n(e,"createEl",this,3)([t,i,r]),s=a.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(s.appendChild(_l("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(_l("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),a}},{key:"handleClick",value:function(t){if(n(e,"handleClick",this,3)([t]),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks)for(var i=this.player_.audioTracks(),r=0;r<i.length;r++){var a=i[r];a!==this.track&&(a.enabled=a===this.track)}}},{key:"handleTracksChange",value:function(e){this.selected(this.track.enabled)}}])}();Mc.registerComponent("AudioTrackMenuItem",Jh);var Zh=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),i.tracks=t.audioTracks(),(n=c(this,e,[t,i])).setIcon("audio"),n}return f(e,jh),y(e,[{key:"buildCSSClass",value:function(){return"vjs-audio-button ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-audio-button ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}},{key:"createItems",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.hideThreshold_=1;for(var t=this.player_.audioTracks(),n=0;n<t.length;n++){var i=t[n];e.push(new Jh(this.player_,{track:i,selectable:!0,multiSelectable:!1}))}return e}}])}();Zh.prototype.controlText_="Audio Track",Mc.registerComponent("AudioTrackButton",Zh);var ep=function(){function e(t,n){var i;g(this,e);var r=n.rate,a=parseFloat(r,10);return n.label=r,n.selected=a===t.playbackRate(),n.selectable=!0,n.multiSelectable=!1,(i=c(this,e,[t,n])).label=r,i.rate=a,i.on(t,"ratechange",function(e){return i.update(e)}),i}return f(e,Fh),y(e,[{key:"handleClick",value:function(t){n(e,"handleClick",this,3)([]),this.player().playbackRate(this.rate)}},{key:"update",value:function(e){this.selected(this.player().playbackRate()===this.rate)}}])}();ep.prototype.contentElType="button",Mc.registerComponent("PlaybackRateMenuItem",ep);var tp=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).menuButton_.el_.setAttribute("aria-describedby",i.labelElId_),i.updateVisibility(),i.updateLabel(),i.on(t,"loadstart",function(e){return i.updateVisibility(e)}),i.on(t,"ratechange",function(e){return i.updateLabel(e)}),i.on(t,"playbackrateschange",function(e){return i.handlePlaybackRateschange(e)}),i}return f(e,Bh),y(e,[{key:"createEl",value:function(){var t=n(e,"createEl",this,3)([]);return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=_l("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),t.appendChild(this.labelEl_),t}},{key:"dispose",value:function(){this.labelEl_=null,n(e,"dispose",this,3)([])}},{key:"buildCSSClass",value:function(){return"vjs-playback-rate ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"buildWrapperCSSClass",value:function(){return"vjs-playback-rate ".concat(n(e,"buildWrapperCSSClass",this,3)([]))}},{key:"createItems",value:function(){for(var e=this.playbackRates(),t=[],n=e.length-1;n>=0;n--)t.push(new ep(this.player(),{rate:e[n]+"x"}));return t}},{key:"handlePlaybackRateschange",value:function(e){this.update()}},{key:"playbackRates",value:function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]}},{key:"playbackRateSupported",value:function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}},{key:"updateVisibility",value:function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}},{key:"updateLabel",value:function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}])}();tp.prototype.controlText_="Playback Rate",Mc.registerComponent("PlaybackRateMenuButton",tp);var np=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Mc),y(e,[{key:"buildCSSClass",value:function(){return"vjs-spacer ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.className||(i.className=this.buildCSSClass()),n(e,"createEl",this,3)([t,i,r])}}])}();Mc.registerComponent("Spacer",np);var ip=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,np),y(e,[{key:"buildCSSClass",value:function(){return"vjs-custom-control-spacer ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:this.buildCSSClass(),textContent:" "}])}}])}();Mc.registerComponent("CustomControlSpacer",ip);var rp=function(){function e(){return g(this,e),c(this,e,arguments)}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["div",{className:"vjs-control-bar",dir:"ltr"}])}}])}();rp.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]},Mc.registerComponent("ControlBar",rp);var ap=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).on(t,"error",function(e){i.open(e)}),i}return f(e,td),y(e,[{key:"buildCSSClass",value:function(){return"vjs-error-display ".concat(n(e,"buildCSSClass",this,3)([]))}},{key:"content",value:function(){var e=this.player().error();return e?this.localize(e.message):""}}])}();ap.prototype.options_=Object.assign({},td.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Mc.registerComponent("ErrorDisplay",ap);var sp=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),(n=c(this,e,[t,i])).el_.setAttribute("aria-labelledby",n.selectLabelledbyIds),n}return f(e,Mc),y(e,[{key:"createEl",value:function(){var e=this;return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),_l("select",{id:this.options_.id},{},this.options_.SelectOptions.map(function(t){var n=(e.options_.labelId?e.options_.labelId:"vjs-track-option-".concat(ic()))+"-"+t[1].replace(/\W+/g,""),i=_l("option",{id:n,value:e.localize(t[0]),textContent:e.localize(t[1])});return i.setAttribute("aria-labelledby","".concat(e.selectLabelledbyIds," ").concat(n)),i}))}}])}();Mc.registerComponent("TextTrackSelect",sp);var op=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,e);var r=_l("legend",{textContent:(n=c(this,e,[t,i])).localize(n.options_.legendText),id:n.options_.legendId});n.el().appendChild(r);var a,s=_(n.options_.selects);try{for(s.s();!(a=s.n()).done;){var o=a.value,u=n.options_.selectConfigs[o],l=u.className,d=u.id.replace("%s",n.options_.id_),h=null,p="vjs_select_".concat(ic());if("colors"===n.options_.type){h=_l("span",{className:l});var f=_l("label",{id:d,className:"vjs-label",textContent:n.localize(u.label)});f.setAttribute("for",p),h.appendChild(f)}var m=new sp(t,{SelectOptions:u.options,legendId:n.options_.legendId,id:p,labelId:d});n.addChild(m),"colors"===n.options_.type&&(h.appendChild(m.el()),n.el().appendChild(h))}}catch(v){s.e(v)}finally{s.f()}return n}return f(e,Mc),y(e,[{key:"createEl",value:function(){return _l("fieldset",{className:this.options_.className})}}])}();Mc.registerComponent("TextTrackFieldset",op);var up=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,e);var r=(n=c(this,e,[t,i])).options_.textTrackComponentid,a=new op(t,{id_:r,legendId:"captions-text-legend-".concat(r),legendText:n.localize("Text"),className:"vjs-fg vjs-track-setting",selects:n.options_.fieldSets[0],selectConfigs:n.options_.selectConfigs,type:"colors"});n.addChild(a);var s=new op(t,{id_:r,legendId:"captions-background-".concat(r),legendText:n.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:n.options_.fieldSets[1],selectConfigs:n.options_.selectConfigs,type:"colors"});n.addChild(s);var o=new op(t,{id_:r,legendId:"captions-window-".concat(r),legendText:n.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:n.options_.fieldSets[2],selectConfigs:n.options_.selectConfigs,type:"colors"});return n.addChild(o),n}return f(e,Mc),y(e,[{key:"createEl",value:function(){return _l("div",{className:"vjs-track-settings-colors"})}}])}();Mc.registerComponent("TextTrackSettingsColors",up);var lp=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,e);var r=(n=c(this,e,[t,i])).options_.textTrackComponentid,a=new op(t,{id_:r,legendId:"captions-font-size-".concat(r),legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:n.options_.fieldSets[0],selectConfigs:n.options_.selectConfigs,type:"font"});n.addChild(a);var s=new op(t,{id_:r,legendId:"captions-edge-style-".concat(r),legendText:n.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:n.options_.fieldSets[1],selectConfigs:n.options_.selectConfigs,type:"font"});n.addChild(s);var o=new op(t,{id_:r,legendId:"captions-font-family-".concat(r),legendText:n.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:n.options_.fieldSets[2],selectConfigs:n.options_.selectConfigs,type:"font"});return n.addChild(o),n}return f(e,Mc),y(e,[{key:"createEl",value:function(){return _l("div",{className:"vjs-track-settings-font"})}}])}();Mc.registerComponent("TextTrackSettingsFont",lp);var cp=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};g(this,e);var r=(n=c(this,e,[t,i])).localize("restore all settings to the default values"),a=new ah(t,{controlText:r,className:"vjs-default-button"});a.el().classList.remove("vjs-control","vjs-button"),a.el().textContent=n.localize("Reset"),n.addChild(a);var s=new ah(t,{controlText:r,className:"vjs-done-button"});return s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=n.localize("Done"),n.addChild(s),n}return f(e,Mc),y(e,[{key:"createEl",value:function(){return _l("div",{className:"vjs-track-settings-controls"})}}])}();Mc.registerComponent("TrackSettingsControls",cp);var dp="vjs-text-track-settings",hp=["#000","Black"],pp=["#00F","Blue"],fp=["#0FF","Cyan"],mp=["#0F0","Green"],gp=["#F0F","Magenta"],vp=["#F00","Red"],yp=["#FFF","White"],_p=["#FF0","Yellow"],bp=["1","Opaque"],Tp=["0.5","Semi-Transparent"],kp=["0","Transparent"],Sp={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[hp,yp,vp,mp,pp,_p,gp,fp],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[bp,Tp,kp],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[yp,hp,vp,mp,pp,_p,gp,fp],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:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[bp,Tp],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:[kp,Tp,bp],className:"vjs-window-opacity vjs-opacity"}};function wp(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}Sp.windowColor.options=Sp.backgroundColor.options;var Ep=function(){function e(t,n){var i;return g(this,e),n.temporary=!1,(i=c(this,e,[t,n])).updateDisplay=i.updateDisplay.bind(i),i.fill(),i.hasBeenOpened_=i.hasBeenFilled_=!0,i.renderModalComponents(t),i.endDialog=_l("p",{className:"vjs-control-text",textContent:i.localize("End of dialog window.")}),i.el().appendChild(i.endDialog),i.setDefaults(),void 0===n.persistTextTrackSettings&&(i.options_.persistTextTrackSettings=i.options_.playerOptions.persistTextTrackSettings),i.bindFunctionsToSelectsAndButtons(),i.options_.persistTextTrackSettings&&i.restoreSettings(),i}return f(e,td),y(e,[{key:"renderModalComponents",value:function(e){var t=new up(e,{textTrackComponentid:this.id_,selectConfigs:Sp,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);var n=new lp(e,{textTrackComponentid:this.id_,selectConfigs:Sp,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(n);var i=new cp(e);this.addChild(i)}},{key:"bindFunctionsToSelectsAndButtons",value:function(){var e=this;this.on(this.$(".vjs-done-button"),["click","tap"],function(){e.saveSettings(),e.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],function(){e.setDefaults(),e.updateDisplay()}),Pu(Sp,function(t){e.on(e.$(t.selector),"change",e.updateDisplay)})}},{key:"dispose",value:function(){this.endDialog=null,n(e,"dispose",this,3)([])}},{key:"label",value:function(){return this.localize("Caption Settings Dialog")}},{key:"description",value:function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}},{key:"buildCSSClass",value:function(){return n(e,"buildCSSClass",this,3)([])+" vjs-text-track-settings"}},{key:"getValues",value:function(){var e=this;return Ru(Sp,function(t,n,i){var r,a,s=(r=e.$(n.selector),a=n.parser,wp(r.options[r.options.selectedIndex].value,a));return void 0!==s&&(t[i]=s),t},{})}},{key:"setValues",value:function(e){var t=this;Pu(Sp,function(n,i){!function(e,t,n){if(t)for(var i=0;i<e.options.length;i++)if(wp(e.options[i].value,n)===t){e.selectedIndex=i;break}}(t.$(n.selector),e[i],n.parser)})}},{key:"setDefaults",value:function(){var e=this;Pu(Sp,function(t){var n=t.hasOwnProperty("default")?t.default:0;e.$(t.selector).selectedIndex=n})}},{key:"restoreSettings",value:function(){var e;try{e=JSON.parse(wn.localStorage.getItem(dp))}catch(t){Iu.warn(t)}e&&this.setValues(e)}},{key:"saveSettings",value:function(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?wn.localStorage.setItem(dp,JSON.stringify(e)):wn.localStorage.removeItem(dp)}catch(t){Iu.warn(t)}}}},{key:"updateDisplay",value:function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}},{key:"handleLanguagechange",value:function(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}])}();Mc.registerComponent("TextTrackSettings",Ep);var Cp=function(){function e(t,n){var i;g(this,e);var r=n.ResizeObserver||wn.ResizeObserver;null===n.ResizeObserver&&(r=!1);var a=Uu({createEl:!r,reportTouchActivity:!1},n);return(i=c(this,e,[t,a])).ResizeObserver=n.ResizeObserver||wn.ResizeObserver,i.loadListener_=null,i.resizeObserver_=null,i.debouncedHandler_=yc(function(){i.resizeHandler()},100,!1,i),r?(i.resizeObserver_=new i.ResizeObserver(i.debouncedHandler_),i.resizeObserver_.observe(t.el())):(i.loadListener_=function(){if(i.el_&&i.el_.contentWindow){var e=i.debouncedHandler_,t=i.unloadListener_=function(){lc(this,"resize",e),lc(this,"unload",t),t=null};uc(i.el_.contentWindow,"unload",t),uc(i.el_.contentWindow,"resize",e)}},i.one("load",i.loadListener_)),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return n(e,"createEl",this,3)(["iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"}])}},{key:"resizeHandler",value:function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")}},{key:"dispose",value:function(){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,n(e,"dispose",this,3)([])}}])}();Mc.registerComponent("ResizeManager",Cp);var Ap={trackingThreshold:20,liveTolerance:15},Ip=function(){function e(t,n){var i;g(this,e);var r=Uu(Ap,n,{createEl:!1});return(i=c(this,e,[t,r])).trackLiveHandler_=function(){return i.trackLive_()},i.handlePlay_=function(e){return i.handlePlay(e)},i.handleFirstTimeupdate_=function(e){return i.handleFirstTimeupdate(e)},i.handleSeeked_=function(e){return i.handleSeeked(e)},i.seekToLiveEdge_=function(e){return i.seekToLiveEdge(e)},i.reset_(),i.on(i.player_,"durationchange",function(e){return i.handleDurationchange(e)}),i.on(i.player_,"canplay",function(){return i.toggleTracking()}),i}return f(e,Mc),y(e,[{key:"trackLive_",value:function(){var e=this.player_.seekable();if(e&&e.length){var t=Number(wn.performance.now().toFixed(4)),n=-1===this.lastTime_?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+n;var i=this.liveCurrentTime(),r=this.player_.currentTime(),a=this.player_.paused()||this.seekedBehindLive_||Math.abs(i-r)>this.options_.liveTolerance;this.timeupdateSeen_&&i!==1/0||(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}}},{key:"handleDurationchange",value:function(){this.toggleTracking()}},{key:"toggleTracking",value:function(){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())}},{key:"startTracking",value:function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,mc),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_)))}},{key:"handleFirstTimeupdate",value:function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}},{key:"handleSeeked",value:function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}},{key:"handlePlay",value:function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}},{key:"reset_",value:function(){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_)}},{key:"nextSeekedFromUser",value:function(){this.nextSeekedFromUser_=!0}},{key:"stopTracking",value:function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}},{key:"seekableEnd",value:function(){for(var e=this.player_.seekable(),t=[],n=e?e.length:0;n--;)t.push(e.end(n));return t.length?t.sort()[t.length-1]:1/0}},{key:"seekableStart",value:function(){for(var e=this.player_.seekable(),t=[],n=e?e.length:0;n--;)t.push(e.start(n));return t.length?t.sort()[0]:0}},{key:"liveWindow",value:function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}},{key:"isLive",value:function(){return this.isTracking()}},{key:"atLiveEdge",value:function(){return!this.behindLiveEdge()}},{key:"liveCurrentTime",value:function(){return this.pastSeekEnd()+this.seekableEnd()}},{key:"pastSeekEnd",value:function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}},{key:"behindLiveEdge",value:function(){return this.behindLiveEdge_}},{key:"isTracking",value:function(){return"number"==typeof this.trackingInterval_}},{key:"seekToLiveEdge",value:function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}},{key:"dispose",value:function(){this.stopTracking(),n(e,"dispose",this,3)([])}}])}();Mc.registerComponent("LiveTracker",Ip);var xp=function(){function e(t,n){var i;return g(this,e),(i=c(this,e,[t,n])).on("statechanged",function(e){return i.updateDom_()}),i.updateDom_(),i}return f(e,Mc),y(e,[{key:"createEl",value:function(){return this.els={title:_l("div",{className:"vjs-title-bar-title",id:"vjs-title-bar-title-".concat(ic())}),description:_l("div",{className:"vjs-title-bar-description",id:"vjs-title-bar-description-".concat(ic())})},_l("div",{className:"vjs-title-bar"},{},Mu(this.els))}},{key:"updateDom_",value:function(){var e=this,t=this.player_.tech_,n=t&&t.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(function(t){var r=e.state[t],a=e.els[t],s=i[t];Ml(a),r&&bl(a,r),n&&(n.removeAttribute(s),r&&n.setAttribute(s,a.id))}),this.state.title||this.state.description?this.show():this.hide()}},{key:"update",value:function(e){this.setState(e)}},{key:"dispose",value:function(){var t=this.player_.tech_,i=t&&t.el_;i&&(i.removeAttribute("aria-labelledby"),i.removeAttribute("aria-describedby")),n(e,"dispose",this,3)([]),this.els=null}}])}();Mc.registerComponent("TitleBar",xp);var Lp={initialDisplay:4e3,position:[],takeFocus:!1},Dp=function(){function e(t,n){var i;return g(this,e),n=Uu(Lp,n),(i=c(this,e,[t,n])).controlText(n.controlText),i.hide(),i.on(i.player_,["useractive","userinactive"],function(e){i.removeClass("force-display")}),i}return f(e,ah),y(e,[{key:"buildCSSClass",value:function(){return"vjs-transient-button focus-visible ".concat(this.options_.position.map(function(e){return"vjs-".concat(e)}).join(" "))}},{key:"createEl",value:function(){var e=_l("button",{},{type:"button",class:this.buildCSSClass()},_l("span"));return this.controlTextEl_=e.querySelector("span"),e}},{key:"show",value:function(){var t=this;n(e,"show",this,3)([]),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(function(){t.removeClass("force-display")},this.options_.initialDisplay)}},{key:"hide",value:function(){this.removeClass("force-display"),n(e,"hide",this,3)([])}},{key:"dispose",value:function(){this.player_.clearTimeout(this.forceDisplayTimeout),n(e,"dispose",this,3)([])}}])}();Mc.registerComponent("TransientButton",Dp);var Pp=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var n=e.$$("source"),i=[],r="";if(!n.length)return!1;for(var a=0;a<n.length;a++){var s=n[a].src;s&&-1===i.indexOf(s)&&i.push(s)}return!!i.length&&(1===i.length&&(r=i[0]),e.triggerSourceset(r),!0)},Rp=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(e){var t=Ln.createElement(this.nodeName.toLowerCase());t.innerHTML=e;for(var n=Ln.createDocumentFragment();t.childNodes.length;)n.appendChild(t.childNodes[0]);return this.innerText="",wn.Element.prototype.appendChild.call(this,n),this.innerHTML}}),Op=function(e,t){for(var n={},i=0;i<e.length&&!((n=Object.getOwnPropertyDescriptor(e[i],t))&&n.set&&n.get);i++);return n.enumerable=!0,n.configurable=!0,n},Np=function(e){var t=e.el();if(!t.resetSourceWatch_){var n={},i=function(e){return Op([e.el(),wn.HTMLMediaElement.prototype,wn.Element.prototype,Rp],"innerHTML")}(e),r=function(n){return function(){for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];var s=n.apply(t,r);return Pp(e),s}};["append","appendChild","insertAdjacentHTML"].forEach(function(e){t[e]&&(n[e]=t[e],t[e]=r(n[e]))}),Object.defineProperty(t,"innerHTML",Uu(i,{set:r(i.set)})),t.resetSourceWatch_=function(){t.resetSourceWatch_=null,Object.keys(n).forEach(function(e){t[e]=n[e]}),Object.defineProperty(t,"innerHTML",i)},e.one("sourceset",t.resetSourceWatch_)}},Up=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?vd(wn.Element.prototype.getAttribute.call(this,"src")):""},set:function(e){return wn.Element.prototype.setAttribute.call(this,"src",e),e}}),Mp=function(e){if(e.featuresSourceset){var t=e.el();if(!t.resetSourceset_){var n=function(e){return Op([e.el(),wn.HTMLMediaElement.prototype,Up],"src")}(e),i=t.setAttribute,r=t.load;Object.defineProperty(t,"src",Uu(n,{set:function(i){var r=n.set.call(t,i);return e.triggerSourceset(t.src),r}})),t.setAttribute=function(n,r){var a=i.call(t,n,r);return/src/i.test(n)&&e.triggerSourceset(t.src),a},t.load=function(){var n=r.call(t);return Pp(e)||(e.triggerSourceset(""),Np(e)),n},t.currentSrc?e.triggerSourceset(t.currentSrc):Pp(e)||Np(e),t.resetSourceset_=function(){t.resetSourceset_=null,t.load=r,t.setAttribute=i,Object.defineProperty(t,"src",n),t.resetSourceWatch_&&t.resetSourceWatch_()}}}},Bp=function(){function e(t,n){var i;g(this,e),i=c(this,e,[t,n]);var r=t.source,a=!1;if(i.featuresVideoFrameCallback=i.featuresVideoFrameCallback&&"VIDEO"===i.el_.tagName,r&&(i.el_.currentSrc!==r.src||t.tag&&3===t.tag.initNetworkState_)?i.setSource(r):i.handleLateInit_(i.el_),t.enableSourceset&&i.setupSourcesetHandling_(),i.isScrubbing_=!1,i.el_.hasChildNodes()){for(var s=i.el_.childNodes,o=s.length,u=[];o--;){var l=s[o];"track"===l.nodeName.toLowerCase()&&(i.featuresNativeTextTracks?(i.remoteTextTrackEls().addTrackElement_(l),i.remoteTextTracks().addTrack(l.track),i.textTracks().addTrack(l.track),a||i.el_.hasAttribute("crossorigin")||!_d(l.src)||(a=!0)):u.push(l))}for(var d=0;d<u.length;d++)i.el_.removeChild(u[d])}return i.proxyNativeTracks_(),i.featuresNativeTextTracks&&a&&Iu.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),i.restoreMetadataTracksInIOSNativePlayer_(),(ul||rl)&&!0===t.nativeControlsForTouch&&i.setControls(!0),i.proxyWebkitFullscreen_(),i.triggerReady(),i}return f(e,Ld),y(e,[{key:"dispose",value:function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),e.disposeMediaElement(this.el_),this.options_=null,n(e,"dispose",this,3)([])}},{key:"setupSourcesetHandling_",value:function(){Mp(this)}},{key:"restoreMetadataTracksInIOSNativePlayer_",value:function(){var e,t=this.textTracks(),n=function(){e=[];for(var n=0;n<t.length;n++){var i=t[n];"metadata"===i.kind&&e.push({track:i,storedMode:i.mode})}};n(),t.addEventListener("change",n),this.on("dispose",function(){return t.removeEventListener("change",n)});var i=function(){for(var n=0;n<e.length;n++){var r=e[n];"disabled"===r.track.mode&&r.track.mode!==r.storedMode&&(r.track.mode=r.storedMode)}t.removeEventListener("change",i)};this.on("webkitbeginfullscreen",function(){t.removeEventListener("change",n),t.removeEventListener("change",i),t.addEventListener("change",i)}),this.on("webkitendfullscreen",function(){t.removeEventListener("change",n),t.addEventListener("change",n),t.removeEventListener("change",i)})}},{key:"overrideNative_",value:function(e,t){var n=this;if(t===this["featuresNative".concat(e,"Tracks")]){var i=e.toLowerCase();this["".concat(i,"TracksListeners_")]&&Object.keys(this["".concat(i,"TracksListeners_")]).forEach(function(e){n.el()["".concat(i,"Tracks")].removeEventListener(e,n["".concat(i,"TracksListeners_")][e])}),this["featuresNative".concat(e,"Tracks")]=!t,this["".concat(i,"TracksListeners_")]=null,this.proxyNativeTracksForType_(i)}}},{key:"overrideNativeAudioTracks",value:function(e){this.overrideNative_("Audio",e)}},{key:"overrideNativeVideoTracks",value:function(e){this.overrideNative_("Video",e)}},{key:"proxyNativeTracksForType_",value:function(e){var t=this,n=Ad[e],i=this.el()[n.getterName],r=this[n.getterName]();if(this["featuresNative".concat(n.capitalName,"Tracks")]&&i&&i.addEventListener){var a={change:function(n){var i={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(i),"text"===e&&t[Id.remoteText.getterName]().trigger(i)},addtrack:function(e){r.addTrack(e.track)},removetrack:function(e){r.removeTrack(e.track)}},s=function(){for(var e=[],t=0;t<r.length;t++){for(var n=!1,a=0;a<i.length;a++)if(i[a]===r[t]){n=!0;break}n||e.push(r[t])}for(;e.length;)r.removeTrack(e.shift())};this[n.getterName+"Listeners_"]=a,Object.keys(a).forEach(function(e){var n=a[e];i.addEventListener(e,n),t.on("dispose",function(t){return i.removeEventListener(e,n)})}),this.on("loadstart",s),this.on("dispose",function(e){return t.off("loadstart",s)})}}},{key:"proxyNativeTracks_",value:function(){var e=this;Ad.names.forEach(function(t){e.proxyNativeTracksForType_(t)})}},{key:"createEl",value:function(){var t=this.options_.tag;if(!t||!this.options_.playerElIngest&&!this.movingMediaElementInDOM){if(t){var n=t.cloneNode(!0);t.parentNode&&t.parentNode.insertBefore(n,t),e.disposeMediaElement(t),t=n}else{t=Ln.createElement("video");var i=Uu({},this.options_.tag&&Al(this.options_.tag));ul&&!0===this.options_.nativeControlsForTouch||delete i.controls,Cl(t,Object.assign(i,{id:this.options_.techId,class:"vjs-tech"}))}t.playerId=this.options_.playerId}void 0!==this.options_.preload&&xl(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);for(var r=["loop","muted","playsinline","autoplay"],a=0;a<r.length;a++){var s=r[a],o=this.options_[s];void 0!==o&&(o?xl(t,s,s):Ll(t,s),t[s]=o)}return t}},{key:"handleLateInit_",value:function(e){if(0!==e.networkState&&3!==e.networkState){if(0===e.readyState){var t=!1,n=function(){t=!0};this.on("loadstart",n);var i=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",i),void this.ready(function(){this.off("loadstart",n),this.off("loadedmetadata",i),t||this.trigger("loadstart")})}var r=["loadstart"];r.push("loadedmetadata"),e.readyState>=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready(function(){r.forEach(function(e){this.trigger(e)},this)})}}},{key:"setScrubbing",value:function(e){this.isScrubbing_=e}},{key:"scrubbing",value:function(){return this.isScrubbing_}},{key:"setCurrentTime",value:function(e){try{this.isScrubbing_&&this.el_.fastSeek&&hl?this.el_.fastSeek(e):this.el_.currentTime=e}catch(vy){Iu(vy,"Video is not ready. (Video.js)")}}},{key:"duration",value:function(){var e=this;if(this.el_.duration===1/0&&Gu&&Qu&&0===this.el_.currentTime){var t=function(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))};return this.on("timeupdate",t),NaN}return this.el_.duration||NaN}},{key:"width",value:function(){return this.el_.offsetWidth}},{key:"height",value:function(){return this.el_.offsetHeight}},{key:"proxyWebkitFullscreen_",value:function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},n=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",n),this.on("dispose",function(){e.off("webkitbeginfullscreen",n),e.off("webkitendfullscreen",t)})}}},{key:"supportsFullScreen",value:function(){return"function"==typeof this.el_.webkitEnterFullScreen}},{key:"enterFullScreen",value:function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Qc(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(vy){this.trigger("fullscreenerror",vy)}},0);else try{e.webkitEnterFullScreen()}catch(vy){this.trigger("fullscreenerror",vy)}}},{key:"exitFullScreen",value:function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))}},{key:"requestPictureInPicture",value:function(){return this.el_.requestPictureInPicture()}},{key:"requestVideoFrameCallback",value:function(t){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(t):n(e,"requestVideoFrameCallback",this,3)([t])}},{key:"cancelVideoFrameCallback",value:function(t){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(t):n(e,"cancelVideoFrameCallback",this,3)([t])}},{key:"src",value:function(e){if(void 0===e)return this.el_.src;this.setSrc(e)}},{key:"addSourceElement",value:function(e,t){if(!e)return Iu.error("Invalid source URL."),!1;var n={src:e};t&&(n.type=t);var i=_l("source",{},n);return this.el_.appendChild(i),!0}},{key:"removeSourceElement",value:function(e){if(!e)return Iu.error("Source URL is required to remove the source element."),!1;var t,n=_(this.el_.querySelectorAll("source"));try{for(n.s();!(t=n.n()).done;){var i=t.value;if(i.src===e)return this.el_.removeChild(i),!0}}catch(r){n.e(r)}finally{n.f()}return Iu.warn("No matching source element found with src: ".concat(e)),!1}},{key:"reset",value:function(){e.resetMediaElement(this.el_)}},{key:"currentSrc",value:function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}},{key:"setControls",value:function(e){this.el_.controls=!!e}},{key:"addTextTrack",value:function(t,i,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,r):n(e,"addTextTrack",this,3)([t,i,r])}},{key:"createRemoteTextTrack",value:function(t){if(!this.featuresNativeTextTracks)return n(e,"createRemoteTextTrack",this,3)([t]);var i=Ln.createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t.default&&(i.default=t.default),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i}},{key:"addRemoteTextTrack",value:function(t,i){var r=n(e,"addRemoteTextTrack",this,3)([t,i]);return this.featuresNativeTextTracks&&this.el().appendChild(r),r}},{key:"removeRemoteTextTrack",value:function(t){if(n(e,"removeRemoteTextTrack",this,3)([t]),this.featuresNativeTextTracks)for(var i=this.$$("track"),r=i.length;r--;)t!==i[r]&&t!==i[r].track||this.el().removeChild(i[r])}},{key:"getVideoPlaybackQuality",value:function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return void 0!==this.el().webkitDroppedFrameCount&&void 0!==this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),wn.performance&&(e.creationTime=wn.performance.now()),e}}])}();Bu(Bp,"TEST_VID",function(){if(ml()){var e=Ln.createElement("video"),t=Ln.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}}),Bp.isSupported=function(){try{Bp.TEST_VID.volume=.5}catch(vy){return!1}return!(!Bp.TEST_VID||!Bp.TEST_VID.canPlayType)},Bp.canPlayType=function(e){return Bp.TEST_VID.canPlayType(e)},Bp.canPlaySource=function(e,t){return Bp.canPlayType(e.type)},Bp.canControlVolume=function(){try{var e=Bp.TEST_VID.volume;Bp.TEST_VID.volume=e/2+.1;var t=e!==Bp.TEST_VID.volume;return t&&dl?(wn.setTimeout(function(){Bp&&Bp.prototype&&(Bp.prototype.featuresVolumeControl=e!==Bp.TEST_VID.volume)}),!1):t}catch(vy){return!1}},Bp.canMuteVolume=function(){try{var e=Bp.TEST_VID.muted;return Bp.TEST_VID.muted=!e,Bp.TEST_VID.muted?xl(Bp.TEST_VID,"muted","muted"):Ll(Bp.TEST_VID,"muted"),e!==Bp.TEST_VID.muted}catch(vy){return!1}},Bp.canControlPlaybackRate=function(){if(Gu&&Qu&&Ju<58)return!1;try{var e=Bp.TEST_VID.playbackRate;return Bp.TEST_VID.playbackRate=e/2+.1,e!==Bp.TEST_VID.playbackRate}catch(vy){return!1}},Bp.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(Ln.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(Ln.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(Ln.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(Ln.createElement("audio"),"innerHTML",{get:e,set:e})}catch(vy){return!1}return!0},Bp.supportsNativeTextTracks=function(){return hl||dl&&Qu},Bp.supportsNativeVideoTracks=function(){return!(!Bp.TEST_VID||!Bp.TEST_VID.videoTracks)},Bp.supportsNativeAudioTracks=function(){return!(!Bp.TEST_VID||!Bp.TEST_VID.audioTracks)},Bp.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(e){var t=S(e,2),n=t[0],i=t[1];Bu(Bp.prototype,n,function(){return Bp[i]()},!0)}),Bp.prototype.featuresVolumeControl=Bp.canControlVolume(),Bp.prototype.movingMediaElementInDOM=!dl,Bp.prototype.featuresFullscreenResize=!0,Bp.prototype.featuresProgressEvents=!0,Bp.prototype.featuresTimeupdateEvents=!0,Bp.prototype.featuresVideoFrameCallback=!(!Bp.TEST_VID||!Bp.TEST_VID.requestVideoFrameCallback),Bp.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(vy){}}()}},Bp.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),n=t.length;n--;)e.removeChild(t[n]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(vy){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){Bp.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(e){Bp.prototype["set"+Oc(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}}),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(e){Bp.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(e){Bp.prototype["set"+Oc(e)]=function(t){this.el_[e]=t}}),["pause","load","play"].forEach(function(e){Bp.prototype[e]=function(){return this.el_[e]()}}),Ld.withSourceHandlers(Bp),Bp.nativeSourceHandler={},Bp.nativeSourceHandler.canPlayType=function(e){try{return Bp.TEST_VID.canPlayType(e)}catch(vy){return""}},Bp.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return Bp.nativeSourceHandler.canPlayType(e.type);if(e.src){var n=yd(e.src);return Bp.nativeSourceHandler.canPlayType("video/".concat(n))}return""},Bp.nativeSourceHandler.handleSource=function(e,t,n){t.setSrc(e.src)},Bp.nativeSourceHandler.dispose=function(){},Bp.registerSourceHandler(Bp.nativeSourceHandler),Ld.registerTech("Html5",Bp);var jp=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Fp={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},qp=["tiny","xsmall","small","medium","large","xlarge","huge"],Vp={};qp.forEach(function(e){var t="x"===e.charAt(0)?"x-".concat(e.substring(1)):e;Vp[e]="vjs-layout-".concat(t)});var Hp={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},zp=function(){function e(t,n,i){var r;if(g(this,e),t.id=t.id||n.id||"vjs_video_".concat(ic()),(n=Object.assign(e.getTagSettings(t),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language){var a=t.closest("[lang]");a&&(n.language=a.getAttribute("lang"))}if((r=c(this,e,[null,n,i])).boundDocumentFullscreenChange_=function(e){return r.documentFullscreenChange_(e)},r.boundFullWindowOnEscKey_=function(e){return r.fullWindowOnEscKey(e)},r.boundUpdateStyleEl_=function(e){return r.updateStyleEl_(e)},r.boundApplyInitTime_=function(e){return r.applyInitTime_(e)},r.boundUpdateCurrentBreakpoint_=function(e){return r.updateCurrentBreakpoint_(e)},r.boundHandleTechClick_=function(e){return r.handleTechClick_(e)},r.boundHandleTechDoubleClick_=function(e){return r.handleTechDoubleClick_(e)},r.boundHandleTechTouchStart_=function(e){return r.handleTechTouchStart_(e)},r.boundHandleTechTouchMove_=function(e){return r.handleTechTouchMove_(e)},r.boundHandleTechTouchEnd_=function(e){return r.handleTechTouchEnd_(e)},r.boundHandleTechTap_=function(e){return r.handleTechTap_(e)},r.boundUpdatePlayerHeightOnAudioOnlyMode_=function(e){return r.updatePlayerHeightOnAudioOnlyMode_(e)},r.isFullscreen_=!1,r.log=xu(r.id_),r.fsApi_=Su,r.isPosterFromTech_=!1,r.queuedCallbacks_=[],r.isReady_=!1,r.hasStarted_=!1,r.userActive_=!1,r.debugEnabled_=!1,r.audioOnlyMode_=!1,r.audioPosterMode_=!1,r.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!r.options_||!r.options_.techOrder||!r.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(r.tag=t,r.tagAttributes=t&&Al(t),r.language(r.options_.language),n.languages){var s={};Object.getOwnPropertyNames(n.languages).forEach(function(e){s[e.toLowerCase()]=n.languages[e]}),r.languages_=s}else r.languages_=e.prototype.options_.languages;r.resetCache_(),r.poster_=n.poster||"",r.controls_=!!n.controls,t.controls=!1,t.removeAttribute("controls"),r.changingSrc_=!1,r.playCallbacks_=[],r.playTerminatedQueue_=[],t.hasAttribute("autoplay")?r.autoplay(!0):r.autoplay(r.options_.autoplay),n.plugins&&Object.keys(n.plugins).forEach(function(e){if("function"!=typeof r[e])throw new Error('plugin "'.concat(e,'" does not exist'))}),r.scrubbing_=!1,r.el_=r.createEl(),Lc(r,{eventBusKey:"el_"}),r.fsApi_.requestFullscreen&&(uc(Ln,r.fsApi_.fullscreenchange,r.boundDocumentFullscreenChange_),r.on(r.fsApi_.fullscreenchange,r.boundDocumentFullscreenChange_)),r.fluid_&&r.on(["playerreset","resize"],r.boundUpdateStyleEl_);var o=Uu(r.options_);if(n.plugins&&Object.keys(n.plugins).forEach(function(e){r[e](n.plugins[e])}),n.debug&&r.debug(!0),r.options_.playerOptions=o,r.middleware_=[],r.playbackRates(n.playbackRates),n.experimentalSvgIcons){var u=(new wn.DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg">\n <defs>\n <symbol viewBox="0 0 48 48" id="vjs-icon-play">\n <path d="M16 10v28l22-14z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-pause">\n <path d="M12 38h8V10h-8v28zm16-28v28h8V10h-8z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-audio">\n <path d="M24 2C14.06 2 6 10.06 6 20v14c0 3.31 2.69 6 6 6h6V24h-8v-4c0-7.73 6.27-14 14-14s14 6.27 14 14v4h-8v16h6c3.31 0 6-2.69 6-6V20c0-9.94-8.06-18-18-18z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-captions">\n <path d="M38 8H10c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM22 22h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2zm14 0h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-subtitles">\n <path d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-enter">\n <path d="M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-fullscreen-exit">\n <path d="M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-play-circle">\n <path d="M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-volume-mute">\n <path d="M33 24c0-3.53-2.04-6.58-5-8.05v4.42l4.91 4.91c.06-.42.09-.85.09-1.28zm5 0c0 1.88-.41 3.65-1.08 5.28l3.03 3.03C41.25 29.82 42 27 42 24c0-8.56-5.99-15.72-14-17.54v4.13c5.78 1.72 10 7.07 10 13.41zM8.55 6L6 8.55 15.45 18H6v12h8l10 10V26.55l8.51 8.51c-1.34 1.03-2.85 1.86-4.51 2.36v4.13a17.94 17.94 0 0 0 7.37-3.62L39.45 42 42 39.45l-18-18L8.55 6zM24 8l-4.18 4.18L24 16.36V8z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-volume-low">\n <path d="M14 18v12h8l10 10V8L22 18h-8z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-volume-medium">\n <path d="M37 24c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zm-27-6v12h8l10 10V8L18 18h-8z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-volume-high">\n <path d="M6 18v12h8l10 10V8L14 18H6zm27 6c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zM28 6.46v4.13c5.78 1.72 10 7.07 10 13.41s-4.22 11.69-10 13.41v4.13c8.01-1.82 14-8.97 14-17.54S36.01 8.28 28 6.46z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-spinner">\n <path d="M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64 4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77 18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44 24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0 1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99 12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0 9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z"></path>\n </symbol>\n <symbol viewBox="0 0 24 24" id="vjs-icon-hd">\n <path d="M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-chapters">\n <path d="M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z"></path>\n </symbol>\n <symbol viewBox="0 0 40 40" id="vjs-icon-downloading">\n <path d="M18.208 36.875q-3.208-.292-5.979-1.729-2.771-1.438-4.812-3.729-2.042-2.292-3.188-5.229-1.146-2.938-1.146-6.23 0-6.583 4.334-11.416 4.333-4.834 10.833-5.5v3.166q-5.167.75-8.583 4.646Q6.25 14.75 6.25 19.958q0 5.209 3.396 9.104 3.396 3.896 8.562 4.646zM20 28.417L11.542 20l2.083-2.083 4.917 4.916v-11.25h2.916v11.25l4.875-4.916L28.417 20zm1.792 8.458v-3.167q1.833-.25 3.541-.958 1.709-.708 3.167-1.875l2.333 2.292q-1.958 1.583-4.25 2.541-2.291.959-4.791 1.167zm6.791-27.792q-1.541-1.125-3.25-1.854-1.708-.729-3.541-1.021V3.042q2.5.25 4.77 1.208 2.271.958 4.271 2.5zm4.584 21.584l-2.25-2.25q1.166-1.5 1.854-3.209.687-1.708.937-3.541h3.209q-.292 2.5-1.229 4.791-.938 2.292-2.521 4.209zm.541-12.417q-.291-1.833-.958-3.562-.667-1.73-1.833-3.188l2.375-2.208q1.541 1.916 2.458 4.208.917 2.292 1.167 4.75z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-file-download">\n <path d="M10.8 40.55q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h26.35v-7.7h3.4v7.7q0 1.4-1 2.4t-2.4 1zM24 32.1L13.9 22.05l2.45-2.45 5.95 5.95V7.15h3.4v18.4l5.95-5.95 2.45 2.45z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-done">\n <path d="M9.8 40.5v-3.45h28.4v3.45zm9.2-9.05L7.4 19.85l2.45-2.35L19 26.65l19.2-19.2 2.4 2.4z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-file-download-off">\n <path d="M4.9 4.75L43.25 43.1 41 45.3l-4.75-4.75q-.05.05-.075.025-.025-.025-.075-.025H10.8q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h22.05l-7-7-1.85 1.8L13.9 21.9l1.85-1.85L2.7 7zm26.75 14.7l2.45 2.45-3.75 3.8-2.45-2.5zM25.7 7.15V21.1l-3.4-3.45V7.15z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-share">\n <path d="M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31A5.83 5.83 0 1 0 36 32.17z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-cog">\n <path d="M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 0 0-3.38 1.97L9.9 10.1a1 1 0 0 0-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 0 0 3.38-1.97l4.98 2.01a1 1 0 0 0 1.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-square">\n <path d="M36 8H12c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zm0 28H12V12h24v24z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-circle">\n <circle cx="24" cy="24" r="20"></circle>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-circle-outline">\n <path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-circle-inner-circle">\n <path d="M24 4C12.97 4 4 12.97 4 24s8.97 20 20 20 20-8.97 20-20S35.03 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16zm6-16c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6 6 2.69 6 6z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-cancel">\n <path d="M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-replay">\n <path d="M24 10V2L14 12l10 10v-8c6.63 0 12 5.37 12 12s-5.37 12-12 12-12-5.37-12-12H8c0 8.84 7.16 16 16 16s16-7.16 16-16-7.16-16-16-16z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-repeat">\n <path d="M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-replay-5">\n <path d="M17.689 98l-8.697 8.696 8.697 8.697 2.486-2.485-4.32-4.319h1.302c4.93 0 9.071 1.722 12.424 5.165 3.352 3.443 5.029 7.638 5.029 12.584h3.55c0-2.958-.553-5.73-1.658-8.313-1.104-2.583-2.622-4.841-4.555-6.774-1.932-1.932-4.19-3.45-6.773-4.555-2.584-1.104-5.355-1.657-8.313-1.657H15.5l4.615-4.615zm-8.08 21.659v13.861h11.357v5.008H9.609V143h12.7c.834 0 1.55-.298 2.146-.894.596-.597.895-1.31.895-2.145v-7.781c0-.835-.299-1.55-.895-2.147a2.929 2.929 0 0 0-2.147-.894h-8.227v-5.096H25.35v-4.384z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-replay-10">\n <path d="M42.315 125.63c0-4.997-1.694-9.235-5.08-12.713-3.388-3.479-7.571-5.218-12.552-5.218h-1.315l4.363 4.363-2.51 2.51-8.787-8.786L25.221 97l2.45 2.45-4.662 4.663h1.375c2.988 0 5.788.557 8.397 1.673 2.61 1.116 4.892 2.65 6.844 4.602 1.953 1.953 3.487 4.234 4.602 6.844 1.116 2.61 1.674 5.41 1.674 8.398zM8.183 142v-19.657H3.176V117.8h9.643V142zm13.63 0c-1.156 0-2.127-.393-2.912-1.178-.778-.778-1.168-1.746-1.168-2.902v-16.04c0-1.156.393-2.127 1.178-2.912.779-.779 1.746-1.168 2.902-1.168h7.696c1.156 0 2.126.392 2.911 1.177.779.78 1.168 1.747 1.168 2.903v16.04c0 1.156-.392 2.127-1.177 2.912-.779.779-1.746 1.168-2.902 1.168zm.556-4.636h6.583v-15.02H22.37z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-replay-30">\n <path d="M26.047 97l-8.733 8.732 8.733 8.733 2.496-2.494-4.336-4.338h1.307c4.95 0 9.108 1.73 12.474 5.187 3.367 3.458 5.051 7.668 5.051 12.635h3.565c0-2.97-.556-5.751-1.665-8.346-1.109-2.594-2.633-4.862-4.574-6.802-1.94-1.941-4.208-3.466-6.803-4.575-2.594-1.109-5.375-1.664-8.345-1.664H23.85l4.634-4.634zM2.555 117.531v4.688h10.297v5.25H5.873v4.687h6.979v5.156H2.555V142H13.36c1.061 0 1.95-.395 2.668-1.186.718-.79 1.076-1.772 1.076-2.94v-16.218c0-1.168-.358-2.149-1.076-2.94-.717-.79-1.607-1.185-2.668-1.185zm22.482.14c-1.149 0-2.11.39-2.885 1.165-.78.78-1.172 1.744-1.172 2.893v15.943c0 1.149.388 2.11 1.163 2.885.78.78 1.745 1.172 2.894 1.172h7.649c1.148 0 2.11-.388 2.884-1.163.78-.78 1.17-1.745 1.17-2.894v-15.943c0-1.15-.386-2.111-1.16-2.885-.78-.78-1.746-1.172-2.894-1.172zm.553 4.518h6.545v14.93H25.59z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-forward-5">\n <path d="M29.508 97l-2.431 2.43 4.625 4.625h-1.364c-2.965 0-5.742.554-8.332 1.66-2.589 1.107-4.851 2.629-6.788 4.566-1.937 1.937-3.458 4.2-4.565 6.788-1.107 2.59-1.66 5.367-1.66 8.331h3.557c0-4.957 1.68-9.16 5.04-12.611 3.36-3.45 7.51-5.177 12.451-5.177h1.304l-4.326 4.33 2.49 2.49 8.715-8.716zm-9.783 21.61v13.89h11.382v5.018H19.725V142h12.727a2.93 2.93 0 0 0 2.15-.896 2.93 2.93 0 0 0 .896-2.15v-7.798c0-.837-.299-1.554-.896-2.152a2.93 2.93 0 0 0-2.15-.896h-8.245V123h11.29v-4.392z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-forward-10">\n <path d="M23.119 97l-2.386 2.383 4.538 4.538h-1.339c-2.908 0-5.633.543-8.173 1.63-2.54 1.085-4.76 2.577-6.66 4.478-1.9 1.9-3.392 4.12-4.478 6.66-1.085 2.54-1.629 5.264-1.629 8.172h3.49c0-4.863 1.648-8.986 4.944-12.372 3.297-3.385 7.368-5.078 12.216-5.078h1.279l-4.245 4.247 2.443 2.442 8.55-8.55zm-9.52 21.45v4.42h4.871V142h4.513v-23.55zm18.136 0c-1.125 0-2.066.377-2.824 1.135-.764.764-1.148 1.709-1.148 2.834v15.612c0 1.124.38 2.066 1.139 2.824.764.764 1.708 1.145 2.833 1.145h7.489c1.125 0 2.066-.378 2.824-1.136.764-.764 1.145-1.709 1.145-2.833v-15.612c0-1.125-.378-2.067-1.136-2.825-.764-.764-1.708-1.145-2.833-1.145zm.54 4.42h6.408v14.617h-6.407z"></path>\n </symbol>\n <symbol viewBox="0 96 48 48" id="vjs-icon-forward-30">\n <path d="M25.549 97l-2.437 2.434 4.634 4.635H26.38c-2.97 0-5.753.555-8.347 1.664-2.594 1.109-4.861 2.633-6.802 4.574-1.94 1.94-3.465 4.207-4.574 6.802-1.109 2.594-1.664 5.377-1.664 8.347h3.565c0-4.967 1.683-9.178 5.05-12.636 3.366-3.458 7.525-5.187 12.475-5.187h1.307l-4.335 4.338 2.495 2.494 8.732-8.732zm-11.553 20.53v4.689h10.297v5.249h-6.978v4.688h6.978v5.156H13.996V142h10.808c1.06 0 1.948-.395 2.666-1.186.718-.79 1.077-1.771 1.077-2.94v-16.217c0-1.169-.36-2.15-1.077-2.94-.718-.79-1.605-1.186-2.666-1.186zm21.174.168c-1.149 0-2.11.389-2.884 1.163-.78.78-1.172 1.745-1.172 2.894v15.942c0 1.15.388 2.11 1.162 2.885.78.78 1.745 1.17 2.894 1.17h7.649c1.149 0 2.11-.386 2.885-1.16.78-.78 1.17-1.746 1.17-2.895v-15.942c0-1.15-.387-2.11-1.161-2.885-.78-.78-1.745-1.172-2.894-1.172zm.552 4.516h6.542v14.931h-6.542z"></path>\n </symbol>\n <symbol viewBox="0 0 512 512" id="vjs-icon-audio-description">\n <g fill-rule="evenodd"><path d="M227.29 381.351V162.993c50.38-1.017 89.108-3.028 117.631 17.126 27.374 19.342 48.734 56.965 44.89 105.325-4.067 51.155-41.335 94.139-89.776 98.475-24.085 2.155-71.972 0-71.972 0s-.84-1.352-.773-2.568m48.755-54.804c31.43 1.26 53.208-16.633 56.495-45.386 4.403-38.51-21.188-63.552-58.041-60.796v103.612c-.036 1.466.575 2.22 1.546 2.57"></path><path d="M383.78 381.328c13.336 3.71 17.387-11.06 23.215-21.408 12.722-22.571 22.294-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.226 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M425.154 381.328c13.336 3.71 17.384-11.061 23.215-21.408 12.721-22.571 22.291-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.511c-.586 3.874 2.226 7.315 3.866 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894"></path><path d="M466.26 381.328c13.337 3.71 17.385-11.061 23.216-21.408 12.722-22.571 22.292-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.225 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894M4.477 383.005H72.58l18.573-28.484 64.169-.135s.065 19.413.065 28.62h48.756V160.307h-58.816c-5.653 9.537-140.85 222.697-140.85 222.697zm152.667-145.282v71.158l-40.453-.27 40.453-70.888z"></path></g>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-next-item">\n <path d="M12 36l17-12-17-12v24zm20-24v24h4V12h-4z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-previous-item">\n <path d="M12 12h4v24h-4zm7 12l17 12V12z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-shuffle">\n <path d="M21.17 18.34L10.83 8 8 10.83l10.34 10.34 2.83-2.83zM29 8l4.09 4.09L8 37.17 10.83 40l25.09-25.09L40 19V8H29zm.66 18.83l-2.83 2.83 6.26 6.26L29 40h11V29l-4.09 4.09-6.25-6.26z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-cast">\n <path d="M42 6H6c-2.21 0-4 1.79-4 4v6h4v-6h36v28H28v4h14c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM2 36v6h6c0-3.31-2.69-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.73-6.27-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.15-9.85-22-22-22z"></path>\n </symbol>\n <symbol viewBox="0 0 48 48" id="vjs-icon-picture-in-picture-enter">\n <path d="M38 22H22v11.99h16V22zm8 16V9.96C46 7.76 44.2 6 42 6H6C3.8 6 2 7.76 2 9.96V38c0 2.2 1.8 4 4 4h36c2.2 0 4-1.8 4-4zm-4 .04H6V9.94h36v28.1z"></path>\n </symbol>\n <symbol viewBox="0 0 22 18" id="vjs-icon-picture-in-picture-exit">\n <path d="M18 4H4v10h14V4zm4 12V1.98C22 .88 21.1 0 20 0H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H2V1.97h18v14.05z"></path>\n <path fill="none" d="M-1-3h24v24H-1z"></path>\n </symbol>\n <symbol viewBox="0 0 1792 1792" id="vjs-icon-facebook">\n <path d="M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z"></path>\n </symbol>\n <symbol viewBox="0 0 1792 1792" id="vjs-icon-linkedin">\n <path d="M477 625v991H147V625h330zm21-306q1 73-50.5 122T312 490h-2q-82 0-132-49t-50-122q0-74 51.5-122.5T314 148t133 48.5T498 319zm1166 729v568h-329v-530q0-105-40.5-164.5T1168 862q-63 0-105.5 34.5T999 982q-11 30-11 81v553H659q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5T1285 602q171 0 275 113.5t104 332.5z"></path>\n </symbol>\n <symbol viewBox="0 0 1200 1227" id="vjs-icon-twitter">\n <path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z"/>\n </symbol>\n <symbol viewBox="0 0 1792 1792" id="vjs-icon-tumblr">\n <path d="M1328 1329l80 237q-23 35-111 66t-177 32q-104 2-190.5-26T787 1564t-95-106-55.5-120-16.5-118V676H452V461q72-26 129-69.5t91-90 58-102 34-99T779 12q1-5 4.5-8.5T791 0h244v424h333v252h-334v518q0 30 6.5 56t22.5 52.5 49.5 41.5 81.5 14q78-2 134-29z"></path>\n </symbol>\n <symbol viewBox="0 0 1792 1792" id="vjs-icon-pinterest">\n <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>\n </symbol>\n </defs>\n</svg>',"image/svg+xml");if(u.querySelector("parsererror"))Iu.warn("Failed to load SVG Icons. Falling back to Font Icons."),r.options_.experimentalSvgIcons=null;else{var l=u.documentElement;l.style.display="none",r.el_.appendChild(l),r.addClass("vjs-svg-icons-enabled")}}r.initChildren(),r.isAudio("audio"===t.nodeName.toLowerCase()),r.controls()?r.addClass("vjs-controls-enabled"):r.addClass("vjs-controls-disabled"),r.el_.setAttribute("role","region"),r.isAudio()?r.el_.setAttribute("aria-label",r.localize("Audio Player")):r.el_.setAttribute("aria-label",r.localize("Video Player")),r.isAudio()&&r.addClass("vjs-audio"),n.spatialNavigation&&n.spatialNavigation.enabled&&(r.spatialNavigation=new Xd(r),r.addClass("vjs-spatial-navigation-enabled")),ul&&r.addClass("vjs-touch-enabled"),dl||r.addClass("vjs-workinghover"),e.players[r.id_]=r;var d=_u.split(".")[0];return r.addClass("vjs-v".concat(d)),r.userActive(!0),r.reportUserActivity(),r.one("play",function(e){return r.listenForUserActivity_(e)}),r.on("keydown",function(e){return r.handleKeyDown(e)}),r.on("languagechange",function(e){return r.handleLanguagechange(e)}),r.breakpoints(r.options_.breakpoints),r.responsive(r.options_.responsive),r.on("ready",function(){r.audioPosterMode(r.options_.audioPosterMode),r.audioOnlyMode(r.options_.audioOnlyMode)}),r}return f(e,Mc),y(e,[{key:"dispose",value:function(){var t,i=this;this.trigger("dispose"),this.off("dispose"),lc(Ln,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),lc(Ln,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),e.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),t=this,Pd.hasOwnProperty(t.id())&&delete Pd[t.id()],xd.names.forEach(function(e){var t=xd[e],n=i[t.getterName]();n&&n.off&&n.off()}),n(e,"dispose",this,3)([{restoreEl:this.options_.restoreEl}])}},{key:"createEl",value:function(){var t,i=this.tag,r=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),a="video-js"===this.tag.tagName.toLowerCase();r?t=this.el_=i.parentNode:a||(t=this.el_=n(e,"createEl",this,3)(["div"]));var s=Al(i);if(a){for(t=this.el_=i,i=this.tag=Ln.createElement("video");t.children.length;)i.appendChild(t.firstChild);kl(t,"video-js")||Sl(t,"video-js"),t.appendChild(i),r=this.playerElIngest_=t,Object.keys(t).forEach(function(e){try{i[e]=t[e]}catch(vy){}})}i.setAttribute("tabindex","-1"),s.tabindex="-1",Qu&&nl&&(i.setAttribute("role","application"),s.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in s&&delete s.width,"height"in s&&delete s.height,Object.getOwnPropertyNames(s).forEach(function(e){a&&"class"===e||t.setAttribute(e,s[e]),a&&i.setAttribute(e,s[e])}),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=t.player=this,this.addClass("vjs-paused");var o=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(function(e){return pl[e]}).map(function(e){return"vjs-device-"+e.substring(3).toLowerCase().replace(/\_/g,"-")});if(this.addClass.apply(this,b(o)),!0!==wn.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=Zl("vjs-styles-dimensions");var u=Vl(".vjs-styles-defaults"),l=Vl("head");l.insertBefore(this.styleEl_,u?u.nextSibling:l.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);for(var c=i.getElementsByTagName("a"),d=0;d<c.length;d++){var h=c.item(d);Sl(h,"vjs-hidden"),h.setAttribute("hidden","hidden")}return i.initNetworkState_=i.networkState,i.parentNode&&!r&&i.parentNode.insertBefore(t,i),Tl(i,t),this.children_.unshift(i),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}},{key:"crossOrigin",value:function(e){if(void 0===e)return this.techGet_("crossOrigin");null===e||"anonymous"===e||"use-credentials"===e?(this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)):Iu.warn('crossOrigin must be null, "anonymous" or "use-credentials", given "'.concat(e,'"'))}},{key:"width",value:function(e){return this.dimension("width",e)}},{key:"height",value:function(e){return this.dimension("height",e)}},{key:"dimension",value:function(e,t){var n=e+"_";if(void 0===t)return this[n]||0;if(""===t||"auto"===t)return this[n]=void 0,void this.updateStyleEl_();var i=parseFloat(t);isNaN(i)?Iu.error('Improper value "'.concat(t,'" supplied for for ').concat(e)):(this[n]=i,this.updateStyleEl_())}},{key:"fluid",value:function(e){var t,n,i=this;if(void 0===e)return!!this.fluid_;this.fluid_=!!e,kc(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),n=function(){i.on(["playerreset","resize"],i.boundUpdateStyleEl_)},kc(t=this)?n():(t.eventedCallbacks||(t.eventedCallbacks=[]),t.eventedCallbacks.push(n))):this.removeClass("vjs-fluid"),this.updateStyleEl_()}},{key:"fill",value:function(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}},{key:"aspectRatio",value:function(e){if(void 0===e)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_()}},{key:"updateStyleEl_",value:function(){if(!0!==wn.VIDEOJS_NO_DYNAMIC_STYLE){var e,t,n,i=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=i[1]/i[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,n=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(n),ec(this.styleEl_,"\n .".concat(n," {\n width: ").concat(e,"px;\n height: ").concat(t,"px;\n }\n\n .").concat(n,".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: ").concat(100*r,"%;\n }\n "))}else{var a="number"==typeof this.width_?this.width_:this.options_.width,s="number"==typeof this.height_?this.height_:this.options_.height,o=this.tech_&&this.tech_.el();o&&(a>=0&&(o.width=a),s>=0&&(o.height=s))}}},{key:"loadTech_",value:function(e,t){var n=this;this.tech_&&this.unloadTech_();var i=Oc(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==i&&this.tag&&(Ld.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;var a=this.autoplay();("string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(a=!1);var s={source:t,autoplay:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:"".concat(this.id(),"_").concat(r,"_api"),playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};xd.names.forEach(function(e){var t=xd[e];s[t.getterName]=n[t.privateName]}),Object.assign(s,this.options_[i]),Object.assign(s,this.options_[r]),Object.assign(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var o=Ld.getTech(e);if(!o)throw new Error("No Tech named '".concat(i,"' exists! '").concat(i,"' should be registered using videojs.registerTech()'"));this.tech_=new o(s),this.tech_.ready(gc(this,this.handleTechReady_),!0),Zc(this.textTracksJson_||[],this.tech_),jp.forEach(function(e){n.on(n.tech_,e,function(t){return n["handleTech".concat(Oc(e),"_")](t)})}),Object.keys(Fp).forEach(function(e){n.on(n.tech_,e,function(t){0===n.tech_.playbackRate()&&n.tech_.seeking()?n.queuedCallbacks_.push({callback:n["handleTech".concat(Fp[e],"_")].bind(n),event:t}):n["handleTech".concat(Fp[e],"_")](t)})}),this.on(this.tech_,"loadstart",function(e){return n.handleTechLoadStart_(e)}),this.on(this.tech_,"sourceset",function(e){return n.handleTechSourceset_(e)}),this.on(this.tech_,"waiting",function(e){return n.handleTechWaiting_(e)}),this.on(this.tech_,"ended",function(e){return n.handleTechEnded_(e)}),this.on(this.tech_,"seeking",function(e){return n.handleTechSeeking_(e)}),this.on(this.tech_,"play",function(e){return n.handleTechPlay_(e)}),this.on(this.tech_,"pause",function(e){return n.handleTechPause_(e)}),this.on(this.tech_,"durationchange",function(e){return n.handleTechDurationChange_(e)}),this.on(this.tech_,"fullscreenchange",function(e,t){return n.handleTechFullscreenChange_(e,t)}),this.on(this.tech_,"fullscreenerror",function(e,t){return n.handleTechFullscreenError_(e,t)}),this.on(this.tech_,"enterpictureinpicture",function(e){return n.handleTechEnterPictureInPicture_(e)}),this.on(this.tech_,"leavepictureinpicture",function(e){return n.handleTechLeavePictureInPicture_(e)}),this.on(this.tech_,"error",function(e){return n.handleTechError_(e)}),this.on(this.tech_,"posterchange",function(e){return n.handleTechPosterChange_(e)}),this.on(this.tech_,"textdata",function(e){return n.handleTechTextData_(e)}),this.on(this.tech_,"ratechange",function(e){return n.handleTechRateChange_(e)}),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===i&&this.tag||Tl(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}},{key:"unloadTech_",value:function(){var e=this;xd.names.forEach(function(t){var n=xd[t];e[n.privateName]=e[n.getterName]()}),this.textTracksJson_=Jc(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}},{key:"tech",value:function(e){return void 0===e&&Iu.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_}},{key:"version",value:function(){return{"video.js":_u}}},{key:"addTechControlsListeners_",value:function(){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_)}},{key:"removeTechControlsListeners_",value:function(){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_)}},{key:"handleTechReady_",value:function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}},{key:"handleTechLoadStart_",value:function(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())}},{key:"manualAutoplay_",value:function(e){var t=this;if(this.tech_&&"string"==typeof e){var n,i=function(){var e=t.muted();t.muted(!0);var n=function(){t.muted(e)};t.playTerminatedQueue_.push(n);var i=t.play();if(Yc(i))return i.catch(function(e){throw n(),new Error("Rejection at manualAutoplay. Restoring muted value. ".concat(e||""))})};if("any"!==e||this.muted()?n="muted"!==e||this.muted()?this.play():i():Yc(n=this.play())&&(n=n.catch(i)),Yc(n))return n.then(function(){t.trigger({type:"autoplay-success",autoplay:e})}).catch(function(){t.trigger({type:"autoplay-failure",autoplay:e})})}}},{key:"updateSourceCaches_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e,n="";"string"!=typeof t&&(t=e.src,n=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!n&&(n=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var n=e.cache_.sources.filter(function(e){return e.src===t});if(n.length)return n[0].type;for(var i=e.$$("source"),r=0;r<i.length;r++){var a=i[r];if(a.type&&a.src&&a.src===t)return a.type}return Vd(t)}(this,t)),this.cache_.source=Uu({},e,{src:t,type:n});for(var i=this.cache_.sources.filter(function(e){return e.src&&e.src===t}),r=[],a=this.$$("source"),s=[],o=0;o<a.length;o++){var u=Al(a[o]);r.push(u),u.src&&u.src===t&&s.push(u.src)}s.length&&!i.length?this.cache_.sources=r:i.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}},{key:"handleTechSourceset_",value:function(e){var t=this;if(!this.changingSrc_){var n=function(e){return t.updateSourceCaches_(e)},i=this.currentSource().src,r=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==i)&&(n=function(){}),n(r),e.src||this.tech_.any(["sourceset","loadstart"],function(e){if("sourceset"!==e.type){var n=t.techGet_("currentSrc");t.lastSource_.tech=n,t.updateSourceCaches_(n)}})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}},{key:"hasStarted",value:function(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}},{key:"handleTechPlay_",value:function(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}},{key:"handleTechRateChange_",value:function(){this.tech_.playbackRate()>0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach(function(e){return e.callback(e.event)}),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}},{key:"handleTechWaiting_",value:function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime(),n=function(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",n))};this.on("timeupdate",n)}},{key:"handleTechCanPlay_",value:function(){this.removeClass("vjs-waiting"),this.trigger("canplay")}},{key:"handleTechCanPlayThrough_",value:function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}},{key:"handleTechPlaying_",value:function(){this.removeClass("vjs-waiting"),this.trigger("playing")}},{key:"handleTechSeeking_",value:function(){this.addClass("vjs-seeking"),this.trigger("seeking")}},{key:"handleTechSeeked_",value:function(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}},{key:"handleTechPause_",value:function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}},{key:"handleTechEnded_",value:function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}},{key:"handleTechDurationChange_",value:function(){this.duration(this.techGet_("duration"))}},{key:"handleTechClick_",value:function(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?Qc(this.play()):this.pause()))}},{key:"handleTechDoubleClick_",value:function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(t){return t.contains(e.target)})||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"==typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!Ln.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))}},{key:"handleTechTap_",value:function(){this.userActive(!this.userActive())}},{key:"handleTechTouchStart_",value:function(){this.userWasActive=this.userActive()}},{key:"handleTechTouchMove_",value:function(){this.userWasActive&&this.reportUserActivity()}},{key:"handleTechTouchEnd_",value:function(e){e.cancelable&&e.preventDefault()}},{key:"toggleFullscreenClass_",value:function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}},{key:"documentFullscreenChange_",value:function(e){var t=e.target.player;if(!t||t===this){var n=this.el(),i=Ln[this.fsApi_.fullscreenElement]===n;!i&&n.matches&&(i=n.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(i)}}},{key:"handleTechFullscreenChange_",value:function(e,t){var n=this;t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",function(){n.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}},{key:"handleTechFullscreenError_",value:function(e,t){this.trigger("fullscreenerror",t)}},{key:"togglePictureInPictureClass_",value:function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}},{key:"handleTechEnterPictureInPicture_",value:function(e){this.isInPictureInPicture(!0)}},{key:"handleTechLeavePictureInPicture_",value:function(e){this.isInPictureInPicture(!1)}},{key:"handleTechError_",value:function(){var e=this.tech_.error();e&&this.error(e)}},{key:"handleTechTextData_",value:function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}},{key:"getCache",value:function(){return this.cache_}},{key:"resetCache_",value:function(){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}}},{key:"techCall_",value:function(e,t){this.ready(function(){if(e in Md)return function(e,t,n,i){return t[n](e.reduce(jd(n),i))}(this.middleware_,this.tech_,e,t);if(e in Bd)return Nd(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(vy){throw Iu(vy),vy}},!0)}},{key:"techGet_",value:function(e){if(this.tech_&&this.tech_.isReady_){if(e in Ud)return function(e,t,n){return e.reduceRight(jd(n),t[n]())}(this.middleware_,this.tech_,e);if(e in Bd)return Nd(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(vy){if(void 0===this.tech_[e])throw Iu("Video.js: ".concat(e," method not defined for ").concat(this.techName_," playback technology."),vy),vy;if("TypeError"===vy.name)throw Iu("Video.js: ".concat(e," unavailable on ").concat(this.techName_," playback technology element."),vy),this.tech_.isReady_=!1,vy;throw Iu(vy),vy}}}},{key:"play",value:function(){var e=this;return new Promise(function(t){e.play_(t)})}},{key:"play_",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Qc;this.playCallbacks_.push(t);var n=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),i=Boolean(hl||dl);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!n)return this.waitToPlay_=function(t){e.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(!n&&i&&this.load());var r=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===r?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(r)}},{key:"runPlayTerminatedQueue_",value:function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})}},{key:"runPlayCallbacks_",value:function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(t){t(e)})}},{key:"pause",value:function(){this.techCall_("pause")}},{key:"paused",value:function(){return!1!==this.techGet_("paused")}},{key:"played",value:function(){return this.techGet_("played")||Fc(0,0)}},{key:"scrubbing",value:function(e){if(void 0===e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}},{key:"currentTime",value:function(e){return void 0===e?(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime):(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),this.cache_.initTime=0,void(isFinite(e)&&(this.cache_.currentTime=Number(e)))):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_)))}},{key:"applyInitTime_",value:function(){this.currentTime(this.cache_.initTime)}},{key:"duration",value:function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(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"))}},{key:"remainingTime",value:function(){return this.duration()-this.currentTime()}},{key:"remainingTimeDisplay",value:function(){return Math.floor(this.duration())-Math.floor(this.currentTime())}},{key:"buffered",value:function(){var e=this.techGet_("buffered");return e&&e.length||(e=Fc(0,0)),e}},{key:"seekable",value:function(){var e=this.techGet_("seekable");return e&&e.length||(e=Fc(0,0)),e}},{key:"seeking",value:function(){return this.techGet_("seeking")}},{key:"ended",value:function(){return this.techGet_("ended")}},{key:"networkState",value:function(){return this.techGet_("networkState")}},{key:"readyState",value:function(){return this.techGet_("readyState")}},{key:"bufferedPercent",value:function(){return Xc(this.buffered(),this.duration())}},{key:"bufferedEnd",value:function(){var e=this.buffered(),t=this.duration(),n=e.end(e.length-1);return n>t&&(n=t),n}},{key:"volume",value:function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)}},{key:"muted",value:function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)}},{key:"defaultMuted",value:function(e){return void 0!==e&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}},{key:"lastVolume_",value:function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e}},{key:"supportsFullScreen",value:function(){return this.techGet_("supportsFullScreen")||!1}},{key:"isFullscreen",value:function(e){if(void 0!==e){var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_}},{key:"requestFullscreen",value:function(e){this.isInPictureInPicture()&&this.exitPictureInPicture();var t=this;return new Promise(function(n,i){function r(){t.off("fullscreenerror",s),t.off("fullscreenchange",a)}function a(){r(),n()}function s(e,t){r(),i(t)}t.one("fullscreenchange",a),t.one("fullscreenerror",s);var o=t.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(n,i))})}},{key:"requestFullscreenHelper_",value:function(e){var t,n=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(function(){return n.isFullscreen(!0)},function(){return n.isFullscreen(!1)}),i}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}},{key:"exitFullscreen",value:function(){var e=this;return new Promise(function(t,n){function i(){e.off("fullscreenerror",a),e.off("fullscreenchange",r)}function r(){i(),t()}function a(e,t){i(),n(t)}e.one("fullscreenchange",r),e.one("fullscreenerror",a);var s=e.exitFullscreenHelper_();s&&(s.then(i,i),s.then(t,n))})}},{key:"exitFullscreenHelper_",value:function(){var e=this;if(this.fsApi_.requestFullscreen){var t=Ln[this.fsApi_.exitFullscreen]();return t&&Qc(t.then(function(){return e.isFullscreen(!1)})),t}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}},{key:"enterFullWindow",value:function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=Ln.documentElement.style.overflow,uc(Ln,"keydown",this.boundFullWindowOnEscKey_),Ln.documentElement.style.overflow="hidden",Sl(Ln.body,"vjs-full-window"),this.trigger("enterFullWindow")}},{key:"fullWindowOnEscKey",value:function(e){"Escape"===e.key&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}},{key:"exitFullWindow",value:function(){this.isFullscreen(!1),this.isFullWindow=!1,lc(Ln,"keydown",this.boundFullWindowOnEscKey_),Ln.documentElement.style.overflow=this.docOrigOverflow,wl(Ln.body,"vjs-full-window"),this.trigger("exitFullWindow")}},{key:"disablePictureInPicture",value:function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}},{key:"isInPictureInPicture",value:function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_}},{key:"requestPictureInPicture",value:function(){var e=this;if(this.options_.enableDocumentPictureInPicture&&wn.documentPictureInPicture){var t=Ln.createElement(this.el().tagName);return t.classList=this.el().classList,t.classList.add("vjs-pip-container"),this.posterImage&&t.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&t.appendChild(this.titleBar.el().cloneNode(!0)),t.appendChild(_l("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),wn.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(function(n){return Wl(n),e.el_.parentNode.insertBefore(t,e.el_),n.document.body.appendChild(e.el_),n.document.body.classList.add("vjs-pip-window"),e.player_.isInPictureInPicture(!0),e.player_.trigger({type:"enterpictureinpicture",pipWindow:n}),n.addEventListener("pagehide",function(n){var i=n.target.querySelector(".video-js");t.parentNode.replaceChild(i,t),e.player_.isInPictureInPicture(!1),e.player_.trigger("leavepictureinpicture")}),n})}return"pictureInPictureEnabled"in Ln&&!1===this.disablePictureInPicture()?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}},{key:"exitPictureInPicture",value:function(){return wn.documentPictureInPicture&&wn.documentPictureInPicture.window?(wn.documentPictureInPicture.window.close(),Promise.resolve()):"pictureInPictureEnabled"in Ln?Ln.exitPictureInPicture():void 0}},{key:"handleKeyDown",value:function(e){var t=this.options_.userActions;if(t&&t.hotkeys){(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}}},{key:"handleHotkeys",value:function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},n=t.fullscreenKey,i=void 0===n?function(t){return"f"===e.key.toLowerCase()}:n,r=t.muteKey,a=void 0===r?function(t){return"m"===e.key.toLowerCase()}:r,s=t.playPauseKey,o=void 0===s?function(t){return"k"===e.key.toLowerCase()||" "===e.key.toLowerCase()}:s;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();var u=Mc.getComponent("FullscreenToggle");!1!==Ln[this.fsApi_.fullscreenEnabled]&&u.prototype.handleClick.call(this,e)}else if(a.call(this,e)){e.preventDefault(),e.stopPropagation(),Mc.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(o.call(this,e)){e.preventDefault(),e.stopPropagation(),Mc.getComponent("PlayToggle").prototype.handleClick.call(this,e)}}},{key:"canPlayType",value:function(e){for(var t,n=0,i=this.options_.techOrder;n<i.length;n++){var r=i[n],a=Ld.getTech(r);if(a||(a=Mc.getComponent(r)),a){if(a.isSupported()&&(t=a.canPlayType(e)))return t}else Iu.error('The "'.concat(r,'" tech is undefined. Skipped browser support check for that tech.'))}return""}},{key:"selectSource",value:function(e){var t,n,i=this,r=this.options_.techOrder.map(function(e){return[e,Ld.getTech(e)]}).filter(function(e){var t=S(e,2),n=t[0],i=t[1];return i?i.isSupported():(Iu.error('The "'.concat(n,'" tech is undefined. Skipped browser support check for that tech.')),!1)}),a=function(e,t,n){var i;return e.some(function(e){return t.some(function(t){if(i=n(e,t))return!0})}),i},s=function(e,t){var n=S(e,2),r=n[0];if(n[1].canPlaySource(t,i.options_[r.toLowerCase()]))return{source:t,tech:r}};return t=this.options_.sourceOrder?a(e,r,(n=s,function(e,t){return n(t,e)})):a(r,e,s),t||!1}},{key:"handleSrc_",value:function(e,t){var n=this;if(void 0===e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();var i=Hd(e);if(i.length){if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),Od(this,i[0],function(e,r){var a,s;if(n.middleware_=r,t||(n.cache_.sources=i),n.updateSourceCaches_(e),n.src_(e))return i.length>1?n.handleSrc_(i.slice(1)):(n.changingSrc_=!1,n.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),void n.triggerReady());a=r,s=n.tech_,a.forEach(function(e){return e.setTech&&e.setTech(s)})}),i.length>1){var r=function(){n.error(null),n.handleSrc_(i.slice(1),!0)},a=function(){n.off("error",r)};this.one("error",r),this.one("playing",a),this.resetRetryOnError_=function(){n.off("error",r),n.off("playing",a)}}}else this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)}},{key:"src",value:function(e){return this.handleSrc_(e,!1)}},{key:"src_",value:function(e){var t=this,n=this.selectSource([e]);return!n||(Nc(n.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_(n.tech,n.source),this.tech_.ready(function(){t.changingSrc_=!1}),!1))}},{key:"addSourceElement",value:function(e,t){return!!this.tech_&&this.tech_.addSourceElement(e,t)}},{key:"removeSourceElement",value:function(e){return!!this.tech_&&this.tech_.removeSourceElement(e)}},{key:"load",value:function(){this.tech_&&this.tech_.vhs?this.src(this.currentSource()):this.techCall_("load")}},{key:"reset",value:function(){var e=this;this.paused()?this.doReset_():Qc(this.play().then(function(){return e.doReset_()}))}},{key:"doReset_",value:function(){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}),kc(this)&&this.trigger("playerreset")}},{key:"resetControlBarUI_",value:function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}},{key:"resetProgressBar_",value:function(){this.currentTime(0);var e=this.controlBar||{},t=e.currentTimeDisplay,n=e.durationDisplay,i=e.progressControl,r=e.remainingTimeDisplay,a=(i||{}).seekBar;t&&t.updateContent(),n&&n.updateContent(),r&&r.updateContent(),a&&(a.update(),a.loadProgressBar&&a.loadProgressBar.update())}},{key:"resetPlaybackRate_",value:function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}},{key:"resetVolumeBar_",value:function(){this.volume(1),this.trigger("volumechange")}},{key:"currentSources",value:function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t}},{key:"currentSource",value:function(){return this.cache_.source||{}}},{key:"currentSrc",value:function(){return this.currentSource()&&this.currentSource().src||""}},{key:"currentType",value:function(){return this.currentSource()&&this.currentSource().type||""}},{key:"preload",value:function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")}},{key:"autoplay",value:function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"==typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"==typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t=void 0===t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}},{key:"playsinline",value:function(e){return void 0!==e&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}},{key:"loop",value:function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")}},{key:"poster",value:function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}},{key:"handleTechPosterChange_",value:function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}},{key:"controls",value:function(e){if(void 0===e)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_()))}},{key:"usingNativeControls",value:function(e){if(void 0===e)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")))}},{key:"error",value:function(e){var t=this;if(void 0===e)return this.error_||null;if(Tu("beforeerror").forEach(function(n){var i=n(t,e);Ou(i)&&!Array.isArray(i)||"string"==typeof i||"number"==typeof i||null===i?e=i:t.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&e&&4===e.code){var n=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],n),void this.one("loadstart",function(){this.off(["click","touchstart"],n)})}if(null===e)return this.error_=null,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new Kc(e),this.addClass("vjs-error"),Iu.error("(CODE:".concat(this.error_.code," ").concat(Kc.errorTypes[this.error_.code],")"),this.error_.message,this.error_),this.trigger("error"),Tu("error").forEach(function(e){return e(t,t.error_)})}},{key:"reportUserActivity",value:function(e){this.userActivity_=!0}},{key:"userActive",value:function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",function(e){e.stopPropagation(),e.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}},{key:"listenForUserActivity_",value:function(){var e,t,n,i=gc(this,this.reportUserActivity),r=function(t){i(),this.clearInterval(e)};this.on("mousedown",function(){i(),this.clearInterval(e),e=this.setInterval(i,250)}),this.on("mousemove",function(e){e.screenX===t&&e.screenY===n||(t=e.screenX,n=e.screenY,i())}),this.on("mouseup",r),this.on("mouseleave",r);var a,s=this.getChild("controlBar");!s||dl||Gu||(s.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),s.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",i),this.on("keyup",i);this.setInterval(function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var e=this.options_.inactivityTimeout;e<=0||(a=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},e))}},250)}},{key:"playbackRate",value:function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)}},{key:"defaultPlaybackRate",value:function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}},{key:"isAudio",value:function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e}},{key:"updatePlayerHeightOnAudioOnlyMode_",value:function(){var e=this.getChild("ControlBar");e&&this.audioOnlyCache_.controlBarHeight!==e.currentHeight()&&(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}},{key:"enableAudioOnlyUI_",value:function(){var e=this;this.addClass("vjs-audio-only-mode");var t=this.children(),n=this.getChild("ControlBar"),i=n&&n.currentHeight();t.forEach(function(t){t!==n&&t.el_&&!t.hasClass("vjs-hidden")&&(t.hide(),e.audioOnlyCache_.hiddenChildren.push(t))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}},{key:"disableAudioOnlyUI_",value:function(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(function(e){return e.show()}),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}},{key:"audioOnlyMode",value:function(e){var t=this;if("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){var n=[];return this.isInPictureInPicture()&&n.push(this.exitPictureInPicture()),this.isFullscreen()&&n.push(this.exitFullscreen()),this.audioPosterMode()&&n.push(this.audioPosterMode(!1)),Promise.all(n).then(function(){return t.enableAudioOnlyUI_()})}return Promise.resolve().then(function(){return t.disableAudioOnlyUI_()})}},{key:"enablePosterModeUI_",value:function(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}},{key:"disablePosterModeUI_",value:function(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}},{key:"audioPosterMode",value:function(e){var t=this;return"boolean"!=typeof e||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(function(){t.enablePosterModeUI_()}):Promise.resolve().then(function(){t.enablePosterModeUI_()}):Promise.resolve().then(function(){t.disablePosterModeUI_()}))}},{key:"addTextTrack",value:function(e,t,n){if(this.tech_)return this.tech_.addTextTrack(e,t,n)}},{key:"addRemoteTextTrack",value:function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}},{key:"removeRemoteTextTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}},{key:"getVideoPlaybackQuality",value:function(){return this.techGet_("getVideoPlaybackQuality")}},{key:"videoWidth",value:function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}},{key:"videoHeight",value:function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}},{key:"language",value:function(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),kc(this)&&this.trigger("languagechange"))}},{key:"languages",value:function(){return Uu(e.prototype.options_.languages,this.languages_)}},{key:"toJSON",value:function(){var e=Uu(this.options_),t=e.tracks;e.tracks=[];for(var n=0;n<t.length;n++){var i=t[n];(i=Uu(i)).player=void 0,e.tracks[n]=i}return e}},{key:"createModal",value:function(e,t){var n=this;(t=t||{}).content=e||"";var i=new td(this,t);return this.addChild(i),i.on("dispose",function(){n.removeChild(i)}),i.open(),i}},{key:"updateCurrentBreakpoint_",value:function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),n=0;n<qp.length;n++){var i=qp[n];if(t<=this.breakpoints_[i]){if(e===i)return;e&&this.removeClass(Vp[e]),this.addClass(Vp[i]),this.breakpoint_=i;break}}}},{key:"removeCurrentBreakpoint_",value:function(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}},{key:"breakpoints",value:function(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=Object.assign({},Hp,e),this.updateCurrentBreakpoint_()),Object.assign(this.breakpoints_)}},{key:"responsive",value:function(e){return void 0===e?this.responsive_:(e=Boolean(e))!==this.responsive_?(this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e):void 0}},{key:"currentBreakpoint",value:function(){return this.breakpoint_}},{key:"currentBreakpointClass",value:function(){return Vp[this.breakpoint_]||""}},{key:"loadMedia",value:function(e,t){var n=this;if(e&&"object"===k(e)){var i=this.crossOrigin();this.reset(),this.cache_.media=Uu(e);var r=this.cache_.media,a=r.artist,s=r.artwork,o=r.description,u=r.poster,l=r.src,c=r.textTracks,d=r.title;!s&&u&&(this.cache_.media.artwork=[{src:u,type:Vd(u)}]),i&&this.crossOrigin(i),l&&this.src(l),u&&this.poster(u),Array.isArray(c)&&c.forEach(function(e){return n.addRemoteTextTrack(e,!1)}),this.titleBar&&this.titleBar.update({title:d,description:o||a||""}),this.ready(t)}}},{key:"getMedia",value:function(){if(!this.cache_.media){var e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}})};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:Vd(t.poster)}]),t}return Uu(this.cache_.media)}},{key:"debug",value:function(e){if(void 0===e)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)}},{key:"playbackRates",value:function(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every(function(e){return"number"==typeof e})&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}],[{key:"getTagSettings",value:function(e){var t={sources:[],tracks:[]},n=Al(e),i=n["data-setup"];if(kl(e,"vjs-fill")&&(n.fill=!0),kl(e,"vjs-fluid")&&(n.fluid=!0),null!==i)try{Object.assign(n,JSON.parse(i||"{}"))}catch(vy){Iu.error("data-setup",vy)}if(Object.assign(t,n),e.hasChildNodes())for(var r=e.childNodes,a=0,s=r.length;a<s;a++){var o=r[a],u=o.nodeName.toLowerCase();"source"===u?t.sources.push(Al(o)):"track"===u&&t.tracks.push(Al(o))}return t}}])}();xd.names.forEach(function(e){var t=xd[e];zp.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),zp.prototype.crossorigin=zp.prototype.crossOrigin,zp.players={};var Wp=wn.navigator;zp.prototype.options_={techOrder:Ld.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Wp&&(Wp.languages&&Wp.languages[0]||Wp.userLanguage||Wp.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},jp.forEach(function(e){zp.prototype["handleTech".concat(Oc(e),"_")]=function(){return this.trigger(e)}}),Mc.registerComponent("Player",zp);var Gp="plugin",Xp="activePlugins_",Kp={},Yp=function(e){return Kp.hasOwnProperty(e)},Qp=function(e){return Yp(e)?Kp[e]:void 0},$p=function(e,t){e[Xp]=e[Xp]||{},e[Xp][t]=!0},Jp=function(e,t,n){var i=(n?"before":"")+"pluginsetup";e.trigger(i,t),e.trigger(i+":"+t.name,t)},Zp=function(e,n){return n.prototype.name=e,function(){Jp(this,{name:e,plugin:n,instance:null},!0);for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];var s=t(n,[this].concat(r));return this[e]=function(){return s},Jp(this,s.getEventHash()),s}},ef=function(){function e(t){if(g(this,e),this.constructor===e)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t,this.log||(this.log=this.player.log.createLogger(this.name)),Lc(this),delete this.trigger,Pc(this,this.constructor.defaultState),$p(t,this.name),this.dispose=this.dispose.bind(this),t.on("dispose",this.dispose)}return y(e,[{key:"version",value:function(){return this.constructor.VERSION}},{key:"getEventHash",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}},{key:"trigger",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return cc(this.eventBusEl_,e,this.getEventHash(t))}},{key:"handleStateChanged",value:function(e){}},{key:"dispose",value:function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Xp][e]=!1,this.player=this.state=null,t[e]=Zp(e,Kp[e])}}],[{key:"isBasic",value:function(t){var n="string"==typeof t?Qp(t):t;return"function"==typeof n&&!e.prototype.isPrototypeOf(n.prototype)}},{key:"registerPlugin",value:function(t,n){if("string"!=typeof t)throw new Error('Illegal plugin name, "'.concat(t,'", must be a string, was ').concat(k(t),"."));if(Yp(t))Iu.warn('A plugin named "'.concat(t,'" already exists. You may want to avoid re-registering plugins!'));else if(zp.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'.concat(t,'", cannot share a name with an existing player method!'));if("function"!=typeof n)throw new Error('Illegal plugin for "'.concat(t,'", must be a function, was ').concat(k(n),"."));return Kp[t]=n,t!==Gp&&(e.isBasic(n)?zp.prototype[t]=function(e,t){var n=function(){Jp(this,{name:e,plugin:t,instance:null},!0);var n=t.apply(this,arguments);return $p(this,e),Jp(this,{name:e,plugin:t,instance:n}),n};return Object.keys(t).forEach(function(e){n[e]=t[e]}),n}(t,n):zp.prototype[t]=Zp(t,n)),n}},{key:"deregisterPlugin",value:function(e){if(e===Gp)throw new Error("Cannot de-register base plugin.");Yp(e)&&(delete Kp[e],delete zp.prototype[e])}},{key:"getPlugins",value:function(){var e;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:Object.keys(Kp)).forEach(function(t){var n=Qp(t);n&&((e=e||{})[t]=n)}),e}},{key:"getPluginVersion",value:function(e){var t=Qp(e);return t&&t.VERSION||""}}])}();function tf(e,t,n,i){return function(e,t){var n=!1;return function(){n||Iu.warn(e),n=!0;for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];return t.apply(this,r)}}("".concat(t," is deprecated and will be removed in ").concat(e,".0; please use ").concat(n," instead."),i)}ef.getPlugin=Qp,ef.BASE_PLUGIN_NAME=Gp,ef.registerPlugin(Gp,ef),zp.prototype.usingPlugin=function(e){return!!this[Xp]&&!0===this[Xp][e]},zp.prototype.hasPlugin=function(e){return!!Yp(e)};var nf=function(e){return 0===e.indexOf("#")?e.slice(1):e};function rf(e,t,n){var i=rf.getPlayer(e);if(i)return t&&Iu.warn('Player "'.concat(e,'" is already initialised. Options will not be applied.')),n&&i.ready(n),i;var r="string"==typeof e?Vl("#"+nf(e)):e;if(!gl(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");var a="getRootNode"in r&&r.getRootNode()instanceof wn.ShadowRoot?r.getRootNode():r.ownerDocument.body;r.ownerDocument.defaultView&&a.contains(r)||Iu.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),Tu("beforesetup").forEach(function(e){var n=e(r,Uu(t));Ou(n)&&!Array.isArray(n)?t=Uu(t,n):Iu.error("please return an object in beforesetup hooks")});var s=Mc.getComponent("Player");return i=new s(r,t,n),Tu("setup").forEach(function(e){return e(i)}),i}if(rf.hooks_=bu,rf.hooks=Tu,rf.hook=function(e,t){Tu(e,t)},rf.hookOnce=function(e,t){Tu(e,[].concat(t).map(function(t){var n=function(){return ku(e,n),t.apply(void 0,arguments)};return n}))},rf.removeHook=ku,!0!==wn.VIDEOJS_NO_DYNAMIC_STYLE&&ml()){var af=Vl(".vjs-styles-defaults");if(!af){af=Zl("vjs-styles-defaults");var sf=Vl("head");sf&&sf.insertBefore(af,sf.firstChild),ec(af,"\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n ")}}Ql(1,rf),rf.VERSION=_u,rf.options=zp.prototype.options_,rf.getPlayers=function(){return zp.players},rf.getPlayer=function(e){var t,n=zp.players;if("string"==typeof e){var i=nf(e),r=n[i];if(r)return r;t=Vl("#"+i)}else t=e;if(gl(t)){var a=t,s=a.player,o=a.playerId;if(s||n[o])return s||n[o]}},rf.getAllPlayers=function(){return Object.keys(zp.players).map(function(e){return zp.players[e]}).filter(Boolean)},rf.players=zp.players,rf.getComponent=Mc.getComponent,rf.registerComponent=function(e,t){return Ld.isTech(t)&&Iu.warn("The ".concat(e," tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)")),Mc.registerComponent.call(Mc,e,t)},rf.getTech=Ld.getTech,rf.registerTech=Ld.registerTech,rf.use=function(e,t){Dd[e]=Dd[e]||[],Dd[e].push(t)},Object.defineProperty(rf,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(rf.middleware,"TERMINATOR",{value:Rd,writeable:!1,enumerable:!0}),rf.browser=pl,rf.obj=Hu,rf.mergeOptions=tf(9,"videojs.mergeOptions","videojs.obj.merge",Uu),rf.defineLazyProperty=tf(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Bu),rf.bind=tf(9,"videojs.bind","native Function.prototype.bind",gc),rf.registerPlugin=ef.registerPlugin,rf.deregisterPlugin=ef.deregisterPlugin,rf.plugin=function(e,t){return Iu.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),ef.registerPlugin(e,t)},rf.getPlugins=ef.getPlugins,rf.getPlugin=ef.getPlugin,rf.getPluginVersion=ef.getPluginVersion,rf.addLanguage=function(e,t){return e=(""+e).toLowerCase(),rf.options.languages=Uu(rf.options.languages,I({},e,t)),rf.options.languages[e]},rf.log=Iu,rf.createLogger=xu,rf.time=Gc,rf.createTimeRange=tf(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Fc),rf.createTimeRanges=tf(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Fc),rf.formatTime=tf(9,"videojs.formatTime","videojs.time.formatTime",Wc),rf.setFormatTime=tf(9,"videojs.setFormatTime","videojs.time.setFormatTime",Hc),rf.resetFormatTime=tf(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",zc),rf.parseUrl=tf(9,"videojs.parseUrl","videojs.url.parseUrl",gd),rf.isCrossOrigin=tf(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",_d),rf.EventTarget=bc,rf.any=hc,rf.on=uc,rf.one=dc,rf.off=lc,rf.trigger=cc,rf.xhr=Zn,rf.TextTrack=Sd,rf.AudioTrack=wd,rf.VideoTrack=Ed,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(e){rf[e]=function(){return Iu.warn("videojs.".concat(e,"() is deprecated; use videojs.dom.").concat(e,"() instead")),Xl[e].apply(null,arguments)}}),rf.computedStyle=tf(9,"videojs.computedStyle","videojs.dom.computedStyle",zl),rf.dom=Xl,rf.fn=_c,rf.num=vh,rf.str=Uc,rf.url=bd,rf.Error={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"};
22
+ /*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */
23
+ var of=y(function e(t){g(this,e);var n=this;return n.id=t.id,n.label=n.id,n.width=t.width,n.height=t.height,n.bitrate=t.bandwidth,n.frameRate=t.frameRate,n.enabled_=t.enabled,Object.defineProperty(n,"enabled",{get:function(){return n.enabled_()},set:function(e){n.enabled_(e)}}),n}),uf=function(){function e(){var t;g(this,e);var n=t=c(this,e);return n.levels_=[],n.selectedIndex_=-1,Object.defineProperty(n,"selectedIndex",{get:function(){return n.selectedIndex_}}),Object.defineProperty(n,"length",{get:function(){return n.levels_.length}}),n[Symbol.iterator]=function(){return n.levels_.values()},d(t,n)}return f(e,rf.EventTarget),y(e,[{key:"addQualityLevel",value:function(e){var t=this.getQualityLevelById(e.id);if(t)return t;var n=this.levels_.length;return t=new of(e),""+n in this||Object.defineProperty(this,n,{get:function(){return this.levels_[n]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}},{key:"removeQualityLevel",value:function(e){for(var t=null,n=0,i=this.length;n<i;n++)if(this[n]===e){t=this.levels_.splice(n,1)[0],this.selectedIndex_===n?this.selectedIndex_=-1:this.selectedIndex_>n&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}},{key:"getQualityLevelById",value:function(e){for(var t=0,n=this.length;t<n;t++){var i=this[t];if(i.id===e)return i}return null}},{key:"dispose",value:function(){this.selectedIndex_=-1,this.levels_.length=0}}])}();for(var lf in uf.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"},uf.prototype.allowedEvents_)uf.prototype["on"+lf]=null;var cf="4.1.0",df=function(e){return t=this,rf.obj.merge({},e),n=t.qualityLevels,i=new uf,r=function(){i.dispose(),t.qualityLevels=n,t.off("dispose",r)},t.on("dispose",r),t.qualityLevels=function(){return i},t.qualityLevels.VERSION=cf,i;var t,n,i,r};rf.registerPlugin("qualityLevels",df),df.VERSION=cf;
24
+ /*! @name @videojs/http-streaming @version 3.16.2 @license Apache-2.0 */
25
+ var hf=Fi,pf=function(e,t){return t&&t.responseURL&&e!==t.responseURL?t.responseURL:e},ff=function(e){return rf.log.debug?rf.log.debug.bind(rf,"VHS:","".concat(e," >")):function(){}};function mf(){for(var e=rf.obj||rf,t=e.merge||e.mergeOptions,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return t.apply(e,i)}function gf(){for(var e=rf.time||rf,t=e.createTimeRanges||e.createTimeRanges,n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return t.apply(e,i)}var vf=1/30,yf=.1,_f=function(e,t){var n,i=[];if(e&&e.length)for(n=0;n<e.length;n++)t(e.start(n),e.end(n))&&i.push([e.start(n),e.end(n)]);return gf(i)},bf=function(e,t){return _f(e,function(e,n){return e-yf<=t&&n+yf>=t})},Tf=function(e,t){return _f(e,function(e){return e-vf>=t})},kf=function(e){var t=[];if(!e||!e.length)return"";for(var n=0;n<e.length;n++)t.push(e.start(n)+" => "+e.end(n));return t.join(", ")},Sf=function(e){for(var t=[],n=0;n<e.length;n++)t.push({start:e.start(n),end:e.end(n)});return t},wf=function(e){if(e&&e.length&&e.end)return e.end(e.length-1)},Ef=function(e,t){var n=0;if(!e||!e.length)return n;for(var i=0;i<e.length;i++){var r=e.start(i),a=e.end(i);t>a||(n+=t>r&&t<=a?a-t:a-r)}return n},Cf=function(e,t){if(!t.preload)return t.duration;var n=0;return(t.parts||[]).forEach(function(e){n+=e.duration}),(t.preloadHints||[]).forEach(function(t){"PART"===t.type&&(n+=e.partTargetDuration)}),n},Af=function(e){return(e.segments||[]).reduce(function(e,t,n){return t.parts?t.parts.forEach(function(i,r){e.push({duration:i.duration,segmentIndex:n,partIndex:r,part:i,segment:t})}):e.push({duration:t.duration,segmentIndex:n,partIndex:null,segment:t,part:null}),e},[])},If=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},xf=function(e){var t=e.preloadSegment;if(t){var n=t.parts,i=(t.preloadHints||[]).reduce(function(e,t){return e+("PART"===t.type?1:0)},0);return i+=n&&n.length?n.length:0}},Lf=function(e,t){if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;var n=If(t).length>0;return n&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:n&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},Df=function(e,t,n){if(void 0===t&&(t=e.mediaSequence+e.segments.length),t<e.mediaSequence)return 0;var i=function(e,t){var n=0,i=t-e.mediaSequence,r=e.segments[i];if(r){if(void 0!==r.start)return{result:r.start,precise:!0};if(void 0!==r.end)return{result:r.end-r.duration,precise:!0}}for(;i--;){if(void 0!==(r=e.segments[i]).end)return{result:n+r.end,precise:!0};if(n+=Cf(e,r),void 0!==r.start)return{result:n+r.start,precise:!0}}return{result:n,precise:!1}}(e,t);if(i.precise)return i.result;var r=function(e,t){for(var n,i=0,r=t-e.mediaSequence;r<e.segments.length;r++){if(void 0!==(n=e.segments[r]).start)return{result:n.start-i,precise:!0};if(i+=Cf(e,n),void 0!==n.end)return{result:n.end-i,precise:!0}}return{result:-1,precise:!1}}(e,t);return r.precise?r.result:i.result+n},Pf=function(e,t,n){if(!e)return 0;if("number"!=typeof n&&(n=0),void 0===t){if(e.totalDuration)return e.totalDuration;if(!e.endList)return wn.Infinity}return Df(e,t,n)},Rf=function(e){var t=e.defaultDuration,n=e.durationList,i=e.startIndex,r=e.endIndex,a=0;if(i>r){var s=[r,i];i=s[0],r=s[1]}if(i<0){for(var o=i;o<Math.min(0,r);o++)a+=t;i=0}for(var u=i;u<r;u++)a+=n[u].duration;return a},Of=function(e,t,n,i){if(!e||!e.segments)return null;if(e.endList)return Pf(e);if(null===t)return null;t=t||0;var r=Df(e,e.mediaSequence+e.segments.length,t);return n&&(r-=i="number"==typeof i?i:Lf(null,e)),Math.max(0,r)},Nf=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},Uf=function(e){return e.excludeUntil&&e.excludeUntil===1/0},Mf=function(e){var t=Nf(e);return!e.disabled&&!t},Bf=function(e,t){return t.attributes&&t.attributes[e]},jf=function(e,t){if(1===e.playlists.length)return!0;var n=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(function(e){return!!Mf(e)&&(e.attributes.BANDWIDTH||0)<n}).length},Ff=function(e,t){return!(!e&&!t||!e&&t||e&&!t)&&(e===t||(!(!e.id||!t.id||e.id!==t.id)||(!(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)||!(!e.uri||!t.uri||e.uri!==t.uri))))},qf=function(e,t){var n=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},i=!1;for(var r in n){for(var a in n[r])if(i=t(n[r][a]))break;if(i)break}return!!i},Vf=function(e){if(!e||!e.playlists||!e.playlists.length)return qf(e,function(e){return e.playlists&&e.playlists.length||e.uri});for(var t,n=function(){var t=e.playlists[i],n=t.attributes&&t.attributes.CODECS;return n&&n.split(",").every(function(e){return vr(e)})||qf(e,function(e){return Ff(t,e)})?0:{v:!1}},i=0;i<e.playlists.length;i++)if(0!==(t=n())&&t)return t.v;return!0},Hf={liveEdgeDelay:Lf,duration:Pf,seekable:function(e,t,n){var i=t||0,r=Of(e,t,!0,n);return null===r?gf():(r<i&&(r=i),gf(i,r))},getMediaInfoForTime:function(e){for(var t=e.playlist,n=e.currentTime,i=e.startingSegmentIndex,r=e.startingPartIndex,a=e.startTime,s=e.exactManifestTimings,o=n-a,u=Af(t),l=0,c=0;c<u.length;c++){var d=u[c];if(i===d.segmentIndex&&("number"!=typeof r||"number"!=typeof d.partIndex||r===d.partIndex)){l=c;break}}if(o<0){if(l>0)for(var h=l-1;h>=0;h--){var p=u[h];if(o+=p.duration,s){if(o<0)continue}else if(o+vf<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:a-Rf({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:h})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:n}}if(l<0){for(var f=l;f<0;f++)if((o-=t.targetDuration)<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:n};l=0}for(var m=l;m<u.length;m++){var g=u[m];o-=g.duration;var v=g.duration>vf;if(!(0===o)&&!(v&&o+vf>=0)||m===u.length-1){if(s){if(o>0)continue}else if(o-vf>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+Rf({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:m})}}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:n}},isEnabled:Mf,isDisabled:function(e){return e.disabled},isExcluded:Nf,isIncompatible:Uf,playlistEnd:Of,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},hasAttribute:Bf,estimateSegmentRequestTime:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return Bf("BANDWIDTH",n)?(e*n.attributes.BANDWIDTH-8*i)/t:NaN},isLowestEnabledRendition:jf,isAudioOnly:Vf,playlistMatch:Ff,segmentDurationWithParts:Cf},zf=rf.log,Wf=function(e,t){return"".concat(e,"-").concat(t)},Gf=function(e,t,n){return"placeholder-uri-".concat(e,"-").concat(t,"-").concat(n)},Xf=function(e,t){e.mediaGroups&&["AUDIO","SUBTITLES"].forEach(function(n){if(e.mediaGroups[n])for(var i in e.mediaGroups[n])for(var r in e.mediaGroups[n][i]){var a=e.mediaGroups[n][i][r];t(a,n,i,r)}})},Kf=function(e){var t=e.playlist,n=e.uri,i=e.id;t.id=i,t.playlistErrors_=0,n&&(t.uri=n),t.attributes=t.attributes||{}},Yf=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Gf;e.uri=t;for(var i=0;i<e.playlists.length;i++)if(!e.playlists[i].uri){var r="placeholder-uri-".concat(i);e.playlists[i].uri=r}var a=Vf(e);Xf(e,function(t,i,r,s){if(!t.playlists||!t.playlists.length){if(a&&"AUDIO"===i&&!t.uri)for(var o=0;o<e.playlists.length;o++){var u=e.playlists[o];if(u.attributes&&u.attributes.AUDIO&&u.attributes.AUDIO===r)return}t.playlists=[$({},t)]}t.playlists.forEach(function(t,a){var o=n(i,r,s,t),u=Wf(a,o);t.uri?t.resolvedUri=t.resolvedUri||hf(e.uri,t.uri):(t.uri=0===a?o:u,t.resolvedUri=t.uri),t.id=t.id||u,t.attributes=t.attributes||{},e.playlists[t.id]=t,e.playlists[t.uri]=t})}),function(e){for(var t=e.playlists.length;t--;){var n=e.playlists[t];Kf({playlist:n,id:Wf(t,n.uri)}),n.resolvedUri=hf(e.uri,n.uri),e.playlists[n.id]=n,e.playlists[n.uri]=n,n.attributes.BANDWIDTH||zf.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}(e),function(e){Xf(e,function(t){t.uri&&(t.resolvedUri=hf(e.uri,t.uri))})}(e)},Qf=function(){return y(function e(){g(this,e),this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map},[{key:"setOffset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null===this.offset_&&e.length){var t=S(e,1)[0];void 0!==t.programDateTime&&(this.offset_=t.programDateTime/1e3)}}},{key:"setPendingDateRanges",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(e.length){var t=S(e,1)[0].startDate.getTime();this.trimProcessedDateRanges_(t),this.pendingDateRanges_=e.reduce(function(e,t){return e.set(t.id,t),e},new Map)}}},{key:"processDateRange",value:function(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}},{key:"getDateRangesToProcess",value:function(){var e=this;if(null===this.offset_)return[];var t={},n=[];this.pendingDateRanges_.forEach(function(i,r){if(!e.processedDateRanges_.has(r)&&(i.startTime=i.startDate.getTime()/1e3-e.offset_,i.processDateRange=function(){return e.processDateRange(i)},n.push(i),i.class))if(t[i.class]){var a=t[i.class].push(i);i.classListIndex=a-1}else t[i.class]=[i],i.classListIndex=0});for(var i=0,r=n;i<r.length;i++){var a=r[i],s=t[a.class]||[];a.endDate?a.endTime=a.endDate.getTime()/1e3-this.offset_:a.endOnNext&&s[a.classListIndex+1]?a.endTime=s[a.classListIndex+1].startTime:a.duration?a.endTime=a.startTime+a.duration:a.plannedDuration?a.endTime=a.startTime+a.plannedDuration:a.endTime=a.startTime}return n}},{key:"trimProcessedDateRanges_",value:function(e){var t=this;new Map(this.processedDateRanges_).forEach(function(n,i){n.startDate.getTime()<e&&t.processedDateRanges_.delete(i)})}}])}(),$f=function(e){var t=e.requestType,n=e.request,i=e.error,r=e.parseFailure,a=n.status<200||n.status>299,s=n.status>=400&&n.status<=499,o={uri:n.uri,requestType:t},u=a&&!s||r;if(i&&s)o.error=$({},i),o.errorType=rf.Error.NetworkRequestFailed;else if(n.aborted)o.errorType=rf.Error.NetworkRequestAborted;else if(n.timedout)o.erroType=rf.Error.NetworkRequestTimeout;else if(u){var l=r?rf.Error.NetworkBodyParserFailed:rf.Error.NetworkBadStatus;o.errorType=l,o.status=n.status,o.headers=n.headers}return o},Jf=rf.EventTarget,Zf=function(e,t){if(!e)return t;var n=mf(e,t);if(e.preloadHints&&!t.preloadHints&&delete n.preloadHints,e.parts&&!t.parts)delete n.parts;else if(e.parts&&t.parts)for(var i=0;i<t.parts.length;i++)e.parts&&e.parts[i]&&(n.parts[i]=mf(e.parts[i],t.parts[i]));return!e.skipped&&t.skipped&&(n.skipped=!1),e.preload&&!t.preload&&(n.preload=!1),n},em=function(e,t){!e.resolvedUri&&e.uri&&(e.resolvedUri=hf(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=hf(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=hf(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=hf(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(function(e){e.resolvedUri||(e.resolvedUri=hf(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(function(e){e.resolvedUri||(e.resolvedUri=hf(t,e.uri))})},tm=function(e){var t=e.segments||[],n=e.preloadSegment;if(n&&n.parts&&n.parts.length){if(n.preloadHints)for(var i=0;i<n.preloadHints.length;i++)if("MAP"===n.preloadHints[i].type)return t;n.duration=e.targetDuration,n.preload=!0,t.push(n)}return t},nm=function(e,t){return e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment},im=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nm,i=mf(e,{}),r=i.playlists[t.id];if(!r)return null;if(n(r,t))return null;t.segments=tm(t);var a=mf(r,t);if(a.preloadSegment&&!t.preloadSegment&&delete a.preloadSegment,r.segments){if(t.skip){t.segments=t.segments||[];for(var s=0;s<t.skip.skippedSegments;s++)t.segments.unshift({skipped:!0})}a.segments=function(e,t,n){var i=e.slice(),r=t.slice();n=n||0;for(var a,s=[],o=0;o<r.length;o++){var u=i[o+n],l=r[o];u?(a=u.map||a,s.push(Zf(u,l))):(a&&!l.map&&(l.map=a),s.push(l))}return s}(r.segments,t.segments,t.mediaSequence-r.mediaSequence)}a.segments.forEach(function(e){em(e,a.resolvedUri)});for(var o=0;o<i.playlists.length;o++)i.playlists[o].id===t.id&&(i.playlists[o]=a);return i.playlists[t.id]=a,i.playlists[t.uri]=a,Xf(e,function(e,n,i,r){if(e.playlists)for(var s=0;s<e.playlists.length;s++)t.id===e.playlists[s].id&&(e.playlists[s]=a)}),i},rm=function(e,t){var n=e.segments||[],i=n[n.length-1],r=i&&i.parts&&i.parts[i.parts.length-1],a=r&&r.duration||i&&i.duration;return t&&a?1e3*a:500*(e.partTargetDuration||e.targetDuration||10)},am=function(e,t,n){if(e){var i=[];return e.forEach(function(e){if(e.attributes){var t=e.attributes,n=t.BANDWIDTH,r=t.RESOLUTION,a=t.CODECS;i.push({id:e.id,bandwidth:n,resolution:r,codecs:a})}}),{type:t,isLive:n,renditions:i}}},sm=function(){function e(t,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(g(this,e),i=c(this,e),!t)throw new Error("A non-empty playlist URL or object is required");i.logger_=ff("PlaylistLoader");var a=r.withCredentials,s=void 0!==a&&a;i.src=t,i.vhs_=n,i.withCredentials=s,i.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;var o=n.options_;return i.customTagParsers=o&&o.customTagParsers||[],i.customTagMappers=o&&o.customTagMappers||[],i.llhls=o&&o.llhls,i.dateRangesStorage_=new Qf,i.state="HAVE_NOTHING",i.handleMediaupdatetimeout_=i.handleMediaupdatetimeout_.bind(i),i.on("mediaupdatetimeout",i.handleMediaupdatetimeout_),i.on("loadedplaylist",i.handleLoadedPlaylist_.bind(i)),i}return f(e,Jf),y(e,[{key:"handleLoadedPlaylist_",value:function(){var e=this.media();if(e){this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);var t=this.dateRangesStorage_.getDateRangesToProcess();t.length&&this.addDateRangesToTextTrack_&&this.addDateRangesToTextTrack_(t)}}},{key:"handleMediaupdatetimeout_",value:function(){var e=this;if("HAVE_METADATA"===this.state){var t=this.media(),n=hf(this.main.uri,t.uri);this.llhls&&(n=function(e,t){if(t.endList||!t.serverControl)return e;var n={};if(t.serverControl.canBlockReload){var i=t.preloadSegment,r=t.mediaSequence+t.segments.length;if(i){var a=i.parts||[],s=xf(t)-1;s>-1&&s!==a.length-1&&(n._HLS_part=s),(s>-1||a.length)&&r--}n._HLS_msn=r}if(t.serverControl&&t.serverControl.canSkipUntil&&(n._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(n).length){var o=new wn.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(e){n.hasOwnProperty(e)&&o.searchParams.set(e,n[e])}),e=o.toString()}return e}(n,t)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:n,withCredentials:this.withCredentials,requestType:"hls-playlist"},function(t,n){if(e.request)return t?e.playlistRequestError(e.request,e.media(),"HAVE_METADATA"):void e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})})}}},{key:"playlistRequestError",value:function(e,t,n){var i=t.uri,r=t.id;this.request=null,n&&(this.state=n),this.error={playlist:this.main.playlists[r],status:e.status,message:"HLS playlist request error at URL: ".concat(i,"."),responseText:e.responseText,code:e.status>=500?4:2,metadata:$f({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}},{key:"parseManifest_",value:function(e){var t=this,n=e.url,i=e.manifestString;try{return function(e){var t=e.onwarn,n=e.oninfo,i=e.manifestString,r=e.customTagParsers,a=void 0===r?[]:r,s=e.customTagMappers,o=void 0===s?[]:s,u=e.llhls,l=new dr;t&&l.on("warn",t),n&&l.on("info",n),a.forEach(function(e){return l.addParser(e)}),o.forEach(function(e){return l.addTagMapper(e)}),l.push(i),l.end();var c=l.manifest;if(u||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){c.hasOwnProperty(e)&&delete c[e]}),c.segments&&c.segments.forEach(function(e){["parts","preloadHints"].forEach(function(t){e.hasOwnProperty(t)&&delete e[t]})})),!c.targetDuration){var d=10;c.segments&&c.segments.length&&(d=c.segments.reduce(function(e,t){return Math.max(e,t.duration)},0)),t&&t({message:"manifest has no targetDuration defaulting to ".concat(d)}),c.targetDuration=d}var h=If(c);if(h.length&&!c.partTargetDuration){var p=h.reduce(function(e,t){return Math.max(e,t.duration)},0);t&&(t({message:"manifest has no partTargetDuration defaulting to ".concat(p)}),zf.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.")),c.partTargetDuration=p}return c}({onwarn:function(e){var i=e.message;return t.logger_("m3u8-parser warn for ".concat(n,": ").concat(i))},oninfo:function(e){var i=e.message;return t.logger_("m3u8-parser info for ".concat(n,": ").concat(i))},manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(r){this.error=r,this.error.metadata={errorType:rf.Error.StreamingHlsPlaylistParserError,error:r}}}},{key:"haveMetadata",value:function(e){var t=e.playlistString,n=e.playlistObject,i=e.url,r=e.id;this.request=null,this.state="HAVE_METADATA";var a={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:a});var s=n||this.parseManifest_({url:i,manifestString:t});s.lastRequest=Date.now(),Kf({playlist:s,uri:i,id:r});var o=im(this.main,s);this.targetDuration=s.partTargetDuration||s.targetDuration,this.pendingMedia_=null,o?(this.main=o,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(rm(this.media(),!!o)),a.parsedPlaylist=am(this.main.playlists,a.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:a}),this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.trigger("dispose"),this.stopRequest(),wn.clearTimeout(this.mediaUpdateTimeout),wn.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Qf,this.off()}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"media",value:function(e,t){var n=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"==typeof e){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(wn.clearTimeout(this.finalRenditionTimeout),t){var i=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=wn.setTimeout(this.media.bind(this,e,!1),i)}else{var r=this.state,a=!this.media_||e.id!==this.media_.id,s=this.main.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(a&&(this.trigger("mediachanging"),"HAVE_MAIN_MANIFEST"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(rm(e,!0)),a){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;var o={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:o}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},function(t,i){if(n.request){if(e.lastRequest=Date.now(),e.resolvedUri=pf(e.resolvedUri,i),t)return n.playlistRequestError(n.request,e,r);n.trigger({type:"playlistrequestcomplete",metadata:o}),n.haveMetadata({playlistString:i.responseText,url:e.uri,id:e.id}),"HAVE_MAIN_MANIFEST"===r?n.trigger("loadedmetadata"):n.trigger("mediachange")}})}}}},{key:"pause",value:function(){this.mediaUpdateTimeout&&(wn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")}},{key:"load",value:function(e){var t=this;this.mediaUpdateTimeout&&(wn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var n=this.media();if(e){var i=n?(n.partTargetDuration||n.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=wn.setTimeout(function(){t.mediaUpdateTimeout=null,t.load()},i)}else this.started?n&&!n.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()}},{key:"updateMediaUpdateTimeout_",value:function(e){var t=this;this.mediaUpdateTimeout&&(wn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=wn.setTimeout(function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)},e))}},{key:"start",value:function(){var e=this;if(this.started=!0,"object"===k(this.src))return this.src.uri||(this.src.uri=wn.location.href),this.src.resolvedUri=this.src.uri,void setTimeout(function(){e.setupInitialPlaylist(e.src)},0);var t={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},function(n,i){if(e.request){if(e.request=null,n)return e.error={status:i.status,message:"HLS playlist request error at URL: ".concat(e.src,"."),responseText:i.responseText,code:2,metadata:$f({requestType:i.requestType,request:i,error:n})},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.trigger({type:"playlistrequestcomplete",metadata:t}),e.src=pf(e.src,i),e.trigger({type:"playlistparsestart",metadata:t});var r=e.parseManifest_({manifestString:i.responseText,url:e.src});t.parsedPlaylist=am(r.playlists,t.playlistInfo.type,!1),e.trigger({type:"playlistparsecomplete",metadata:t}),e.setupInitialPlaylist(r)}})}},{key:"srcUri",value:function(){return"string"==typeof this.src?this.src:this.src.uri}},{key:"setupInitialPlaylist",value:function(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists)return this.main=e,Yf(this.main,this.srcUri()),e.playlists.forEach(function(e){e.segments=tm(e),e.segments.forEach(function(t){em(t,e.resolvedUri)})}),this.trigger("loadedplaylist"),void(this.request||this.media(this.main.playlists[0]));var t=this.srcUri()||wn.location.href;this.main=function(e,t){var n=Wf(0,t),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:wn.location.href,resolvedUri:wn.location.href,playlists:[{uri:t,id:n,resolvedUri:t,attributes:{}}]};return i.playlists[n]=i.playlists[0],i.playlists[t]=i.playlists[0],i}(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}},{key:"updateOrDeleteClone",value:function(e,t){for(var n=this.main,i=e.ID,r=n.playlists.length;r--;){var a=n.playlists[r];if(a.attributes["PATHWAY-ID"]===i){var s=a.resolvedUri,o=a.id;if(t){var u=this.createCloneURI_(a.resolvedUri,e),l=Wf(i,u),c=this.createCloneAttributes_(i,a.attributes),d=this.createClonePlaylist_(a,l,e,c);n.playlists[r]=d,n.playlists[l]=d,n.playlists[u]=d}else n.playlists.splice(r,1);delete n.playlists[o],delete n.playlists[s]}}this.updateOrDeleteCloneMedia(e,t)}},{key:"updateOrDeleteCloneMedia",value:function(e,t){var n=this.main,i=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(e){if(n.mediaGroups[e]&&n.mediaGroups[e][i])for(var t in n.mediaGroups[e])if(t===i){for(var r in n.mediaGroups[e][t]){n.mediaGroups[e][t][r].playlists.forEach(function(e,t){var i=n.playlists[e.id],r=i.id,a=i.resolvedUri;delete n.playlists[r],delete n.playlists[a]})}delete n.mediaGroups[e][t]}}),t&&this.createClonedMediaGroups_(e)}},{key:"addClonePathway",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.main,i=n.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),a=Wf(e.ID,r),s=this.createCloneAttributes_(e.ID,t.attributes),o=this.createClonePlaylist_(t,a,e,s);n.playlists[i]=o,n.playlists[a]=o,n.playlists[r]=o,this.createClonedMediaGroups_(e)}},{key:"createClonedMediaGroups_",value:function(e){var t=this,n=e.ID,i=e["BASE-ID"],r=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(a){if(r.mediaGroups[a]&&!r.mediaGroups[a][n])for(var s in r.mediaGroups[a])if(s===i){r.mediaGroups[a][n]={};var o=function(i){var o=r.mediaGroups[a][s][i];r.mediaGroups[a][n][i]=$({},o);var u=r.mediaGroups[a][n][i],l=t.createCloneURI_(o.resolvedUri,e);u.resolvedUri=l,u.uri=l,u.playlists=[],o.playlists.forEach(function(s,o){var l=r.playlists[s.id],c=Gf(a,n,i),d=Wf(n,c);if(l&&!r.playlists[d]){var h=t.createClonePlaylist_(l,d,e),p=h.resolvedUri;r.playlists[d]=h,r.playlists[p]=h}u.playlists[o]=t.createClonePlaylist_(s,d,e)})};for(var u in r.mediaGroups[a][s])o(u)}})}},{key:"createClonePlaylist_",value:function(e,t,n,i){var r=this.createCloneURI_(e.resolvedUri,n),a={resolvedUri:r,uri:r,id:t};return e.segments&&(a.segments=[]),i&&(a.attributes=i),mf(e,a)}},{key:"createCloneURI_",value:function(e,t){var n=new URL(e);n.hostname=t["URI-REPLACEMENT"].HOST;for(var i=t["URI-REPLACEMENT"].PARAMS,r=0,a=Object.keys(i);r<a.length;r++){var s=a[r];n.searchParams.set(s,i[s])}return n.href}},{key:"createCloneAttributes_",value:function(e,t){var n=I({},"PATHWAY-ID",e);return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(i){t[i]&&(n[i]=e)}),n}},{key:"getKeyIdSet",value:function(e){if(e.contentProtection){var t=new Set;for(var n in e.contentProtection){var i=e.contentProtection[n].attributes.keyId;i&&t.add(i.toLowerCase())}return t}}}])}(),om=function(e,t,n,i){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),n.headers&&(e.responseHeaders=n.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===n.statusCode||206===n.statusCode||0===n.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),i(t,e)},um=function(){var e=function e(t,n){t=mf({timeout:45e3},t);var i=e.beforeRequest||rf.Vhs.xhr.beforeRequest,r=e._requestCallbackSet||rf.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||rf.Vhs.xhr._responseCallbackSet;i&&"function"==typeof i&&(rf.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(i));var s=!0===rf.Vhs.xhr.original?rf.xhr:rf.Vhs.xhr,o=function(e,t){if(e&&e.size){var n=t;return e.forEach(function(e){n=e(n)}),n}}(r,t);r.delete(i);var u=s(o||t,function(e,t){return function(e,t,n,i){e&&e.size&&e.forEach(function(e){e(t,n,i)})}(a,u,e,t),om(u,e,t,n)}),l=u.abort;return u.abort=function(){return u.aborted=!0,l.apply(u,arguments)},u.uri=t.uri,u.requestType=t.requestType,u.requestTime=Date.now(),u};return e.original=!0,e},lm=function(e){var t,n={};return e.byterange&&(n.Range="bytes="+(t=e.byterange).offset+"-"+("bigint"==typeof t.offset||"bigint"==typeof t.length?wn.BigInt(t.offset)+wn.BigInt(t.length)-wn.BigInt(1):t.offset+t.length-1)),n},cm=function(e,t){return e.start(t)+"-"+e.end(t)},dm=function(e,t){var n=e.toString(16);return"00".substring(0,2-n.length)+n+(t%2?" ":"")},hm=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},pm=function(e){var t={};return Object.keys(e).forEach(function(n){var i=e[n];Er(i)?t[n]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:t[n]=i}),t},fm=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},mm=function(e){return e.resolvedUri},gm=function(e){for(var t=Array.prototype.slice.call(e),n=16,i="",r=0;r<t.length/n;r++)i+=t.slice(r*n,r*n+n).map(dm).join("")+" "+t.slice(r*n,r*n+n).map(hm).join("")+"\n";return i},vm=Object.freeze({__proto__:null,createTransferableMessage:pm,initSegmentId:fm,segmentKeyId:mm,hexDump:gm,tagDump:function(e){var t=e.bytes;return gm(t)},textRanges:function(e){var t,n="";for(t=0;t<e.length;t++)n+=cm(e,t)+" ";return n}}),ym=function(e){var t=e.playlist,n=e.time,i=void 0===n?void 0:n,r=e.callback;if(!r)throw new Error("getProgramTime: callback must be provided");if(!t||void 0===i)return r({message:"getProgramTime: playlist and time must be provided"});var a=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var n,i=0,r=0;r<t.segments.length&&!(e<=(i=(n=t.segments[r]).videoTimingInfo?n.videoTimingInfo.transmuxedPresentationEnd:i+n.duration));r++);var a=t.segments[t.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(e>i){if(e>i+.25*a.duration)return null;n=a}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:i-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}}(i,t);if(!a)return r({message:"valid programTime was not found"});if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:i},o=function(e,t){if(!t.dateTimeObject)return null;var n=t.videoTimingInfo.transmuxerPrependedSeconds,i=e-(t.videoTimingInfo.transmuxedPresentationStart+n);return new Date(t.dateTimeObject.getTime()+1e3*i)}(i,a.segment);return o&&(s.programDateTime=o.toISOString()),r(null,s)},_m=function(e){var t=e.programTime,n=e.playlist,i=e.retryCount,r=void 0===i?2:i,a=e.seekTo,s=e.pauseAfterSeek,o=void 0===s||s,u=e.tech,l=e.callback;if(!l)throw new Error("seekToProgramTime: callback must be provided");if(void 0===t||!n||!a)return l({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!u.hasStarted_)return l({message:"player must be playing a live stream to start buffering"});if(!function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;t<e.segments.length;t++)if(!e.segments[t].dateTimeObject)return!1;return!0}(n))return l({message:"programDateTime tags must be provided in the manifest "+n.resolvedUri});var c=function(e,t){var n;try{n=new Date(e)}catch(vy){return null}if(!t||!t.segments||0===t.segments.length)return null;var i=t.segments[0];if(n<new Date(i.dateTimeObject))return null;for(var r=0;r<t.segments.length-1&&(i=t.segments[r],!(n<new Date(t.segments[r+1].dateTimeObject)));r++);var a,s=t.segments[t.segments.length-1],o=s.dateTimeObject,u=s.videoTimingInfo?(a=s.videoTimingInfo).transmuxedPresentationEnd-a.transmuxedPresentationStart-a.transmuxerPrependedSeconds:s.duration+.25*s.duration;return n>new Date(o.getTime()+1e3*u)?null:(n>new Date(o)&&(i=s),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:Hf.duration(t,t.mediaSequence+t.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})}(t,n);if(!c)return l({message:"".concat(t," was not found in the stream")});var d=c.segment,h=function(e,t){var n,i;try{n=new Date(e),i=new Date(t)}catch(vy){}var r=n.getTime();return(i.getTime()-r)/1e3}(d.dateTimeObject,t);if("estimate"===c.type)return 0===r?l({message:"".concat(t," is not buffered yet. Try again")}):(a(c.estimatedStart+h),void u.one("seeked",function(){_m({programTime:t,playlist:n,retryCount:r-1,seekTo:a,pauseAfterSeek:o,tech:u,callback:l})}));var p=d.start+h;u.one("seeked",function(){return l(null,u.currentTime())}),o&&u.pause(),a(p)},bm=function(e,t){if(4===e.readyState)return t()},Tm=function(e,t,n,i){var r,a=[],s=!1,o=function(e,t,i,r){return t.abort(),s=!0,n(e,t,i,r)},u=function(e,t){if(!s){if(e)return e.metadata=$f({requestType:i,request:t,error:e}),o(e,t,"",a);var n=t.responseText.substring(a&&a.byteLength||0,t.responseText.length);if(a=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(t=t.filter(function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e}),t.length<=1)return Cr(t[0]);var i=t.reduce(function(e,t,n){return e+(t.byteLength||t.length)},0),r=new Uint8Array(i),a=0;return t.forEach(function(e){e=Cr(e),r.set(e,a),a+=e.byteLength}),r}(a,Dr(n,!0)),r=r||Xo(a),a.length<10||r&&a.length<r+2)return bm(t,function(){return o(e,t,"",a)});var u=mu(a);return"ts"===u&&a.length<188||!u&&a.length<376?bm(t,function(){return o(e,t,"",a)}):o(null,t,u,a)}},l=t({uri:e,beforeSend:function(e){e.overrideMimeType("text/plain; charset=x-user-defined"),e.addEventListener("progress",function(t){t.total,t.loaded;return om(e,null,{statusCode:e.status},u)})}},function(e,t){return om(l,e,t,u)});return l},km=rf.EventTarget,Sm=function(e,t){if(!nm(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(var n=0;n<e.segments.length;n++){var i=e.segments[n],r=t.segments[n];if(i.uri!==r.uri)return!1;if(i.byterange||r.byterange){var a=i.byterange,s=r.byterange;if(a&&!s||!a&&s)return!1;if(a.offset!==s.offset||a.length!==s.length)return!1}}return!0},wm=function(e,t,n,i){var r=i.attributes.NAME||n;return"placeholder-uri-".concat(e,"-").concat(t,"-").concat(r)},Em=function(e,t,n){for(var i=!0,r=mf(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts}),a=0;a<t.playlists.length;a++){var s=t.playlists[a];if(s.sidx){var o=uo(s.sidx);n&&n[o]&&n[o].sidx&&to(s,n[o].sidx,s.sidx.resolvedUri)}var u=im(r,s,Sm);u&&(r=u,i=!1)}return Xf(t,function(e,t,n,a){if(e.playlists&&e.playlists.length){var s=e.playlists[0].id,o=im(r,e.playlists[0],Sm);o&&(a in(r=o).mediaGroups[t][n]||(r.mediaGroups[t][n][a]=e),r.mediaGroups[t][n][a].playlists[0]=r.playlists[s],i=!1)}}),function(e,t){Xf(e,function(n,i,r,a){t.mediaGroups[i][r]&&a in t.mediaGroups[i][r]||delete e.mediaGroups[i][r][a]})}(r,t),t.minimumUpdatePeriod!==e.minimumUpdatePeriod&&(i=!1),i?null:r},Cm=function(e,t){return(Boolean(!e.map&&!t.map)||Boolean(e.map&&t.map&&e.map.byterange.offset===t.map.byterange.offset&&e.map.byterange.length===t.map.byterange.length))&&e.uri===t.uri&&e.byterange.offset===t.byterange.offset&&e.byterange.length===t.byterange.length},Am=function(e,t){var n={};for(var i in e){var r=e[i].sidx;if(r){var a=uo(r);if(!t[a])break;var s=t[a].sidxInfo;Cm(s,r)&&(n[a]=t[a])}}return n},Im=function(){function e(t,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3?arguments[3]:void 0;g(this,e),(i=c(this,e)).isPaused_=!0,i.mainPlaylistLoader_=a||i,a||(i.isMain_=!0);var s=r.withCredentials,o=void 0!==s&&s;if(i.vhs_=n,i.withCredentials=o,i.addMetadataToTextTrack=r.addMetadataToTextTrack,!t)throw new Error("A non-empty playlist URL or object is required");return i.on("minimumUpdatePeriod",function(){i.refreshXml_()}),i.on("mediaupdatetimeout",function(){i.refreshMedia_(i.media().id)}),i.state="HAVE_NOTHING",i.loadedPlaylists_={},i.logger_=ff("DashPlaylistLoader"),i.isMain_?(i.mainPlaylistLoader_.srcUrl=t,i.mainPlaylistLoader_.sidxMapping_={}):i.childPlaylist_=t,i}return f(e,km),y(e,[{key:"isPaused",get:function(){return this.isPaused_}},{key:"requestErrored_",value:function(e,t,n){return!this.request||(this.request=null,e?(this.error="object"!==k(e)||e instanceof Error?{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata}:e,n&&(this.state=n),this.trigger("error"),!0):void 0)}},{key:"addSidxSegments_",value:function(e,t,n){var i=this,r=e.sidx&&uo(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r])return wn.clearTimeout(this.mediaRequest_),void(this.mediaRequest_=wn.setTimeout(function(){return n(!1)},0));var a=pf(e.sidx.resolvedUri),s=function(a,s){if(!i.requestErrored_(a,s,t)){var o,u=i.mainPlaylistLoader_.sidxMapping_,l=s.requestType;try{o=Wo(Cr(s.response).subarray(8))}catch(vy){return vy.metadata=$f({requestType:l,request:s,parseFailure:!0}),void i.requestErrored_(vy,s,t)}return u[r]={sidxInfo:e.sidx,sidx:o},to(e,o,e.sidx.resolvedUri),n(!0)}};this.request=Tm(a,this.vhs_.xhr,function(t,n,r,o){if(t)return s(t,n);if(!r||"mp4"!==r){var u=r||"unknown";return s({status:n.status,message:"Unsupported ".concat(u," container type for sidx segment at URL: ").concat(a),response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},n)}var l=e.sidx.byterange,c=l.offset,d=l.length;if(o.length>=d+c)return s(t,{response:o.subarray(c,c+d),status:n.status,uri:n.uri});i.request=i.vhs_.xhr({uri:a,responseType:"arraybuffer",requestType:"dash-sidx",headers:lm({byterange:e.sidx.byterange})},s)},"dash-sidx")}},{key:"dispose",value:function(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},wn.clearTimeout(this.minimumUpdatePeriodTimeout_),wn.clearTimeout(this.mediaRequest_),wn.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()}},{key:"hasPendingRequest",value:function(){return this.request||this.mediaRequest_}},{key:"stopRequest",value:function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}},{key:"media",value:function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var n=this.state;if("string"==typeof e){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}var i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(i&&(this.trigger("mediachanging"),this.trigger("mediachange")));i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,n,function(i){t.haveMetadata({startingState:n,playlist:e})}))}},{key:"haveMetadata",value:function(e){var t=e.startingState,n=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[n.id]=n,wn.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(n.id),"HAVE_MAIN_MANIFEST"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")}},{key:"pause",value:function(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),wn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(wn.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)}},{key:"load",value:function(e){var t=this;this.isPaused_=!1,wn.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var n=this.media();if(e){var i=n?n.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=wn.setTimeout(function(){return t.load()},i)}else this.started?n&&!n.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()}},{key:"start",value:function(){var e=this;if(this.started=!0,!this.isMain_)return wn.clearTimeout(this.mediaRequest_),void(this.mediaRequest_=wn.setTimeout(function(){return e.haveMain_()},0));this.requestMain_(function(t,n){e.haveMain_(),e.hasPendingRequest()||e.media_||e.media(e.mainPlaylistLoader_.main.playlists[0])})}},{key:"requestMain_",value:function(e){var t=this,n={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:n}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},function(i,r){if(i){var a=r.requestType;i.metadata=$f({requestType:a,request:r,error:i})}if(!t.requestErrored_(i,r)){t.trigger({type:"manifestrequestcomplete",metadata:n});var s=r.responseText!==t.mainPlaylistLoader_.mainXml_;return t.mainPlaylistLoader_.mainXml_=r.responseText,r.responseHeaders&&r.responseHeaders.date?t.mainLoaded_=Date.parse(r.responseHeaders.date):t.mainLoaded_=Date.now(),t.mainPlaylistLoader_.srcUrl=pf(t.mainPlaylistLoader_.srcUrl,r),s?(t.handleMain_(),void t.syncClientServerClock_(function(){return e(r,s)})):e(r,s)}"HAVE_NOTHING"===t.state&&(t.started=!1)})}},{key:"syncClientServerClock_",value:function(e){var t=this,n=qo(this.mainPlaylistLoader_.mainXml_);return null===n?(this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()):"DIRECT"===n.method?(this.mainPlaylistLoader_.clientOffset_=n.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:hf(this.mainPlaylistLoader_.srcUrl,n.value),method:n.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},function(i,r){if(t.request){if(i){var a=r.requestType;return t.error.metadata=$f({requestType:a,request:r,error:i}),t.mainPlaylistLoader_.clientOffset_=t.mainLoaded_-Date.now(),e()}var s;s="HEAD"===n.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.mainLoaded_:Date.parse(r.responseText),t.mainPlaylistLoader_.clientOffset_=s-Date.now(),e()}}))}},{key:"haveMain_",value:function(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}},{key:"handleMain_",value:function(){wn.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;var e,t,n,i,r,a,s,o,u=this.mainPlaylistLoader_.main,l={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:l});try{t={mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:u},n=t.mainXml,i=t.srcUrl,r=t.clientOffset,a=t.sidxMapping,s=t.previousManifest,o=Fo(n,{manifestUri:i,clientOffset:r,sidxMapping:a,previousManifest:s}),Yf(o,i,wm),e=o}catch(g){this.error=g,this.error.metadata={errorType:rf.Error.StreamingDashManifestParserError,error:g},this.trigger("error")}u&&(e=Em(u,e,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=e||u;var c=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(c&&c!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=c),(!u||e&&e.minimumUpdatePeriod!==u.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(e),e){var d=e,h=d.duration,p=d.endList,f=[];e.playlists.forEach(function(e){f.push({id:e.id,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS})});var m={duration:h,isLive:!p,renditions:f};l.parsedManifest=m,this.trigger({type:"manifestparsecomplete",metadata:l})}return Boolean(e)}},{key:"updateMinimumUpdatePeriodTimeout_",value:function(){var e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(wn.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);var t=e.main&&e.main.minimumUpdatePeriod;0===t&&(e.media()?t=1e3*e.media().targetDuration:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),"number"!=typeof t||t<=0?t<0&&this.logger_("found invalid minimumUpdatePeriod of ".concat(t,", not setting a timeout")):this.createMUPTimeout_(t)}},{key:"createMUPTimeout_",value:function(e){var t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=wn.setTimeout(function(){t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}},{key:"refreshXml_",value:function(){var e=this;this.requestMain_(function(t,n){var i,r,a;n&&(e.media_&&(e.media_=e.mainPlaylistLoader_.main.playlists[e.media_.id]),e.mainPlaylistLoader_.sidxMapping_=(i=e.mainPlaylistLoader_.main,r=e.mainPlaylistLoader_.sidxMapping_,a=Am(i.playlists,r),Xf(i,function(e,t,n,i){if(e.playlists&&e.playlists.length){var s=e.playlists;a=mf(a,Am(s,r))}}),a),e.addSidxSegments_(e.media(),e.state,function(t){e.refreshMedia_(e.media().id)}))})}},{key:"refreshMedia_",value:function(e){var t=this;if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();var n=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==n[e];if(i?this.media_=n[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){var r=function(){t.media().endList||(t.mediaUpdateTimeout=wn.setTimeout(function(){t.trigger("mediaupdatetimeout"),r()},rm(t.media(),Boolean(i))))};r()}this.trigger("loadedplaylist")}},{key:"addEventStreamToMetadataTrack_",value:function(e){if(e&&this.mainPlaylistLoader_.main.eventStream){var t=this.mainPlaylistLoader_.main.eventStream.map(function(e){return{cueTime:e.start,frames:[{data:e.messageData}]}});this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}},{key:"getKeyIdSet",value:function(e){if(e.contentProtection){var t=new Set;for(var n in e.contentProtection){var i=e.contentProtection[n].attributes["cenc:default_KID"];i&&t.add(i.replace(/-/g,"").toLowerCase())}return t}}}])}(),xm={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},Lm=function(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e},Dm=function(e){return function(){var t=function(e){try{return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}catch(vy){var t=new BlobBuilder;return t.append(e),URL.createObjectURL(t.getBlob())}}(e),n=Lm(new Worker(t));n.objURL=t;var i=n.terminate;return n.on=n.addEventListener,n.off=n.removeEventListener,n.terminate=function(){return URL.revokeObjectURL(t),i.call(this)},n}},Pm=function(e){return"var browserWorkerPolyFill = ".concat(Lm.toString(),";\n")+"browserWorkerPolyFill(self);\n"+e},Rm=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},Om=Pm(Rm(function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==U.global?U.global:"undefined"!=typeof self?self:{},t=function(){this.init=function(){var e={};this.on=function(t,n){e[t]||(e[t]=[]),e[t]=e[t].concat(n)},this.off=function(t,n){var i;return!!e[t]&&(i=e[t].indexOf(n),e[t]=e[t].slice(),e[t].splice(i,1),i>-1)},this.trigger=function(t){var n,i,r,a;if(n=e[t])if(2===arguments.length)for(r=n.length,i=0;i<r;++i)n[i].call(this,arguments[1]);else{for(a=[],i=arguments.length,i=1;i<arguments.length;++i)a.push(arguments[i]);for(r=n.length,i=0;i<r;++i)n[i].apply(this,a)}},this.dispose=function(){e={}}}};t.prototype.pipe=function(e){return this.on("data",function(t){e.push(t)}),this.on("done",function(t){e.flush(t)}),this.on("partialdone",function(t){e.partialFlush(t)}),this.on("endedtimeline",function(t){e.endTimeline(t)}),this.on("reset",function(t){e.reset(t)}),e},t.prototype.push=function(e){this.trigger("data",e)},t.prototype.flush=function(e){this.trigger("done",e)},t.prototype.partialFlush=function(e){this.trigger("partialdone",e)},t.prototype.endTimeline=function(e){this.trigger("endedtimeline",e)},t.prototype.reset=function(e){this.trigger("reset",e)};var n,i,r,a,s,o,u,l,c,d,h,p,f,m,v,_,b,T,S,w,E,C,A,I,x,L,D,P,R,O,N,M,B,j,F,q,V,H,z,W,G=t,X=Math.pow(2,32),K={getUint64:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getBigUint64?(t=n.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(t):t:n.getUint32(0)*X+n.getUint32(4)},MAX_UINT32:X},Y=K.MAX_UINT32;!function(){var e;if(C={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:[]},"undefined"!=typeof Uint8Array){for(e in C)C.hasOwnProperty(e)&&(C[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);A=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),x=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),I=new Uint8Array([0,0,0,1]),L=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]),D=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]),P={video:L,audio:D},N=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),O=new Uint8Array([0,0,0,0,0,0,0,0]),M=new Uint8Array([0,0,0,0,0,0,0,0]),B=M,j=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),F=M,R=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),n=function(e){var t,n,i=[],r=0;for(t=1;t<arguments.length;t++)i.push(arguments[t]);for(t=i.length;t--;)r+=i[t].byteLength;for(n=new Uint8Array(r+8),new DataView(n.buffer,n.byteOffset,n.byteLength).setUint32(0,n.byteLength),n.set(e,4),t=0,r=8;t<i.length;t++)n.set(i[t],r),r+=i[t].byteLength;return n},i=function(){return n(C.dinf,n(C.dref,N))},r=function(e){return n(C.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,e.audioobjecttype<<3|e.samplingfrequencyindex>>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},v=function(e){return n(C.hdlr,P[e])},m=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(t[12]=e.samplerate>>>24&255,t[13]=e.samplerate>>>16&255,t[14]=e.samplerate>>>8&255,t[15]=255&e.samplerate),n(C.mdhd,t)},f=function(e){return n(C.mdia,m(e),v(e.type),o(e))},s=function(e){return n(C.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},o=function(e){return n(C.minf,"video"===e.type?n(C.vmhd,R):n(C.smhd,O),i(),b(e))},u=function(e,t){for(var i=[],r=t.length;r--;)i[r]=S(t[r]);return n.apply(null,[C.moof,s(e)].concat(i))},l=function(e){for(var t=e.length,i=[];t--;)i[t]=h(e[t]);return n.apply(null,[C.moov,d(4294967295)].concat(i).concat(c(e)))},c=function(e){for(var t=e.length,i=[];t--;)i[t]=w(e[t]);return n.apply(null,[C.mvex].concat(i))},d=function(e){var t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,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 n(C.mvhd,t)},_=function(e){var t,i,r=e.samples||[],a=new Uint8Array(4+r.length);for(i=0;i<r.length;i++)t=r[i].flags,a[i+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return n(C.sdtp,a)},b=function(e){return n(C.stbl,T(e),n(C.stts,F),n(C.stsc,B),n(C.stsz,j),n(C.stco,M))},T=function(e){return n(C.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),"video"===e.type?q(e):V(e))},q=function(e){var t,i,r=e.sps||[],a=e.pps||[],s=[],o=[];for(t=0;t<r.length;t++)s.push((65280&r[t].byteLength)>>>8),s.push(255&r[t].byteLength),s=s.concat(Array.prototype.slice.call(r[t]));for(t=0;t<a.length;t++)o.push((65280&a[t].byteLength)>>>8),o.push(255&a[t].byteLength),o=o.concat(Array.prototype.slice.call(a[t]));if(i=[C.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,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,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]),n(C.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),n(C.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var u=e.sarRatio[0],l=e.sarRatio[1];i.push(n(C.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l])))}return n.apply(null,i)},V=function(e){return n(C.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),r(e))},p=function(e){var t=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,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,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return n(C.tkhd,t)},S=function(e){var t,i,r,a,s,o;return t=n(C.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/Y),o=Math.floor(e.baseMediaDecodeTime%Y),i=n(C.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),"audio"===e.type?(r=E(e,92),n(C.traf,t,i,r)):(a=_(e),r=E(e,a.length+92),n(C.traf,t,i,r,a))},h=function(e){return e.duration=e.duration||4294967295,n(C.trak,p(e),f(e))},w=function(e){var t=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(t[t.length-1]=0),n(C.trex,t)},W=function(e,t){var n=0,i=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(n=1),void 0!==e[0].size&&(i=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,n|i|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},z=function(e,t){var i,r,a,s,o,u;for(t+=20+16*(s=e.samples||[]).length,a=W(s,t),(r=new Uint8Array(a.length+16*s.length)).set(a),i=a.length,u=0;u<s.length;u++)o=s[u],r[i++]=(4278190080&o.duration)>>>24,r[i++]=(16711680&o.duration)>>>16,r[i++]=(65280&o.duration)>>>8,r[i++]=255&o.duration,r[i++]=(4278190080&o.size)>>>24,r[i++]=(16711680&o.size)>>>16,r[i++]=(65280&o.size)>>>8,r[i++]=255&o.size,r[i++]=o.flags.isLeading<<2|o.flags.dependsOn,r[i++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,r[i++]=61440&o.flags.degradationPriority,r[i++]=15&o.flags.degradationPriority,r[i++]=(4278190080&o.compositionTimeOffset)>>>24,r[i++]=(16711680&o.compositionTimeOffset)>>>16,r[i++]=(65280&o.compositionTimeOffset)>>>8,r[i++]=255&o.compositionTimeOffset;return n(C.trun,r)},H=function(e,t){var i,r,a,s,o,u;for(t+=20+8*(s=e.samples||[]).length,a=W(s,t),(i=new Uint8Array(a.length+8*s.length)).set(a),r=a.length,u=0;u<s.length;u++)o=s[u],i[r++]=(4278190080&o.duration)>>>24,i[r++]=(16711680&o.duration)>>>16,i[r++]=(65280&o.duration)>>>8,i[r++]=255&o.duration,i[r++]=(4278190080&o.size)>>>24,i[r++]=(16711680&o.size)>>>16,i[r++]=(65280&o.size)>>>8,i[r++]=255&o.size;return n(C.trun,i)},E=function(e,t){return"audio"===e.type?H(e,t):z(e,t)};var Q,$,J,Z,ee,te,ne,ie,re={ftyp:a=function(){return n(C.ftyp,A,I,A,x)},mdat:function(e){return n(C.mdat,e)},moof:u,moov:l,initSegment:function(e){var t,n=a(),i=l(e);return(t=new Uint8Array(n.byteLength+i.byteLength)).set(n),t.set(i,n.byteLength),t}},ae=function(e,t){var n={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return n.dataOffset=t,n.compositionTimeOffset=e.pts-e.dts,n.duration=e.duration,n.size=4*e.length,n.size+=e.byteLength,e.keyFrame&&(n.flags.dependsOn=2,n.flags.isNonSyncSample=0),n},se={groupNalsIntoFrames:function(e){var t,n,i=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,i.byteLength=0,t=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(n=e[t]).nalUnitType?(i.length&&(i.duration=n.dts-i.dts,r.byteLength+=i.byteLength,r.nalCount+=i.length,r.duration+=i.duration,r.push(i)),(i=[n]).byteLength=n.data.byteLength,i.pts=n.pts,i.dts=n.dts):("slice_layer_without_partitioning_rbsp_idr"===n.nalUnitType&&(i.keyFrame=!0),i.duration=n.dts-i.dts,i.byteLength+=n.data.byteLength,i.push(n));return r.length&&(!i.duration||i.duration<=0)&&(i.duration=r[r.length-1].duration),r.byteLength+=i.byteLength,r.nalCount+=i.length,r.duration+=i.duration,r.push(i),r},groupFramesIntoGops:function(e){var t,n,i=[],r=[];for(i.byteLength=0,i.nalCount=0,i.duration=0,i.pts=e[0].pts,i.dts=e[0].dts,r.byteLength=0,r.nalCount=0,r.duration=0,r.pts=e[0].pts,r.dts=e[0].dts,t=0;t<e.length;t++)(n=e[t]).keyFrame?(i.length&&(r.push(i),r.byteLength+=i.byteLength,r.nalCount+=i.nalCount,r.duration+=i.duration),(i=[n]).nalCount=n.length,i.byteLength=n.byteLength,i.pts=n.pts,i.dts=n.dts,i.duration=n.duration):(i.duration+=n.duration,i.nalCount+=n.length,i.byteLength+=n.byteLength,i.push(n));return r.length&&i.duration<=0&&(i.duration=r[r.length-1].duration),r.byteLength+=i.byteLength,r.nalCount+=i.nalCount,r.duration+=i.duration,r.push(i),r},extendFirstKeyFrame:function(e){var t;return!e[0][0].keyFrame&&e.length>1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},generateSampleTable:function(e,t){var n,i,r,a,s,o=t||0,u=[];for(n=0;n<e.length;n++)for(a=e[n],i=0;i<a.length;i++)s=a[i],o+=(r=ae(s,o)).size,u.push(r);return u},concatenateNalData:function(e){var t,n,i,r,a,s,o=0,u=e.byteLength,l=e.nalCount,c=new Uint8Array(u+4*l),d=new DataView(c.buffer);for(t=0;t<e.length;t++)for(r=e[t],n=0;n<r.length;n++)for(a=r[n],i=0;i<a.length;i++)s=a[i],d.setUint32(o,s.data.byteLength),o+=4,c.set(s.data,o),o+=s.data.byteLength;return c},generateSampleTableForFrame:function(e,t){var n,i=[];return n=ae(e,t||0),i.push(n),i},concatenateNalDataForFrame:function(e){var t,n,i=0,r=e.byteLength,a=e.length,s=new Uint8Array(r+4*a),o=new DataView(s.buffer);for(t=0;t<e.length;t++)n=e[t],o.setUint32(i,n.data.byteLength),i+=4,s.set(n.data,i),i+=n.data.byteLength;return s}},oe=[33,16,5,32,164,27],ue=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],le=function(e){for(var t=[];e--;)t.push(0);return t},ce=9e4;te=function(e,t){return $(ee(e,t))},ne=function(e,t){return J(Z(e),t)},ie=function(e,t,n){return Z(n?e:e-t)};var de={ONE_SECOND_IN_TS:ce,secondsToVideoTs:$=function(e){return e*ce},secondsToAudioTs:J=function(e,t){return e*t},videoTsToSeconds:Z=function(e){return e/ce},audioTsToSeconds:ee=function(e,t){return e/t},audioTsToVideoTs:te,videoTsToAudioTs:ne,metadataTsToSeconds:ie},he=function(){if(!Q){var e={96e3:[oe,[227,64],le(154),[56]],88200:[oe,[231],le(170),[56]],64e3:[oe,[248,192],le(240),[56]],48e3:[oe,[255,192],le(268),[55,148,128],le(54),[112]],44100:[oe,[255,192],le(268),[55,163,128],le(84),[112]],32e3:[oe,[255,192],le(268),[55,234],le(226),[112]],24e3:[oe,[255,192],le(268),[55,255,128],le(268),[111,112],le(126),[224]],16e3:[oe,[255,192],le(268),[55,255,128],le(268),[111,255],le(269),[223,108],le(195),[1,192]],12e3:[ue,le(268),[3,127,248],le(268),[6,255,240],le(268),[13,255,224],le(268),[27,253,128],le(259),[56]],11025:[ue,le(268),[3,127,248],le(268),[6,255,240],le(268),[13,255,224],le(268),[27,255,192],le(268),[55,175,128],le(108),[112]],8e3:[ue,le(268),[3,121,16],le(47),[7]]};t=e,Q=Object.keys(t).reduce(function(e,n){return e[n]=new Uint8Array(t[n].reduce(function(e,t){return e.concat(t)},[])),e},{})}var t;return Q},pe=de,fe={prefixWithSilence:function(e,t,n,i){var r,a,s,o,u,l=0,c=0,d=0;if(t.length&&(r=pe.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(pe.ONE_SECOND_IN_TS/(e.samplerate/1024)),n&&i&&(l=r-Math.max(n,i),d=(c=Math.floor(l/a))*a),!(c<1||d>pe.ONE_SECOND_IN_TS/2))){for((s=he()[e.samplerate])||(s=t[0].data),o=0;o<c;o++)u=t[0],t.splice(0,0,{data:s,dts:u.dts-a,pts:u.pts-a});return e.baseMediaDecodeTime-=Math.floor(pe.videoTsToAudioTs(d,e.samplerate)),d}},trimAdtsFramesByEarliestDts:function(e,t,n){return t.minSegmentDts>=n?e:(t.minSegmentDts=1/0,e.filter(function(e){return e.dts>=n&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)}))},generateSampleTable:function(e){var t,n,i=[];for(t=0;t<e.length;t++)n=e[t],i.push({size:n.data.byteLength,duration:1024});return i},concatenateFrameData:function(e){var t,n,i=0,r=new Uint8Array(function(e){var t,n=0;for(t=0;t<e.length;t++)n+=e[t].data.byteLength;return n}(e));for(t=0;t<e.length;t++)n=e[t],r.set(n.data,i),i+=n.data.byteLength;return r}},me=de.ONE_SECOND_IN_TS,ge={clearDtsInfo:function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},calculateTrackBaseMediaDecodeTime:function(e,t){var n,i=e.minSegmentDts;return t||(i-=e.timelineStartInfo.dts),n=e.timelineStartInfo.baseMediaDecodeTime,n+=i,n=Math.max(0,n),"audio"===e.type&&(n*=e.samplerate/me,n=Math.floor(n)),n},collectDtsInfo:function(e,t){"number"==typeof t.pts&&(void 0===e.timelineStartInfo.pts&&(e.timelineStartInfo.pts=t.pts),void 0===e.minSegmentPts?e.minSegmentPts=t.pts:e.minSegmentPts=Math.min(e.minSegmentPts,t.pts),void 0===e.maxSegmentPts?e.maxSegmentPts=t.pts:e.maxSegmentPts=Math.max(e.maxSegmentPts,t.pts)),"number"==typeof t.dts&&(void 0===e.timelineStartInfo.dts&&(e.timelineStartInfo.dts=t.dts),void 0===e.minSegmentDts?e.minSegmentDts=t.dts:e.minSegmentDts=Math.min(e.minSegmentDts,t.dts),void 0===e.maxSegmentDts?e.maxSegmentDts=t.dts:e.maxSegmentDts=Math.max(e.maxSegmentDts,t.dts))}},ve={parseSei:function(e){for(var t=0,n={payloadType:-1,payloadSize:0},i=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)i+=255,t++;for(i+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!n.payload&&4===i){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){n.payloadType=i,n.payloadSize=r,n.payload=e.subarray(t,t+r);break}n.payload=void 0}t+=r,i=0,r=0}return n},parseUserData:function(e){return 181!==e.payload[0]||49!=(e.payload[1]<<8|e.payload[2])||"GA94"!==String.fromCharCode(e.payload[3],e.payload[4],e.payload[5],e.payload[6])||3!==e.payload[7]?null:e.payload.subarray(8,e.payload.length-1)},parseCaptionPackets:function(e,t){var n,i,r,a,s=[];if(!(64&t[0]))return s;for(i=31&t[0],n=0;n<i;n++)a={type:3&t[(r=3*n)+2],pts:e},4&t[r+2]&&(a.ccData=t[r+3]<<8|t[r+4],s.push(a));return s},discardEmulationPreventionBytes:function(e){for(var t,n,i=e.byteLength,r=[],a=1;a<i-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=i-r.length,n=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),n[a]=e[s];return n},USER_DATA_REGISTERED_ITU_T_T35:4},ye=G,_e=ve,be=function(e){e=e||{},be.prototype.init.call(this),this.parse708captions_="boolean"!=typeof e.parse708captions||e.parse708captions,this.captionPackets_=[],this.ccStreams_=[new Le(0,0),new Le(0,1),new Le(1,0),new Le(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ee({captionServices:e.captionServices})),this.reset(),this.ccStreams_.forEach(function(e){e.on("data",this.trigger.bind(this,"data")),e.on("partialdone",this.trigger.bind(this,"partialdone")),e.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")))};be.prototype=new ye,be.prototype.push=function(e){var t,n,i;if("sei_rbsp"===e.nalUnitType&&(t=_e.parseSei(e.escapedRBSP)).payload&&t.payloadType===_e.USER_DATA_REGISTERED_ITU_T_T35&&(n=_e.parseUserData(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));i=_e.parseCaptionPackets(e.pts,n),this.captionPackets_=this.captionPackets_.concat(i),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},be.prototype.flushCCStreams=function(e){this.ccStreams_.forEach(function(t){return"flush"===e?t.flush():t.partialFlush()},this)},be.prototype.flushStream=function(e){this.captionPackets_.length?(this.captionPackets_.forEach(function(e,t){e.presortIndex=t}),this.captionPackets_.sort(function(e,t){return e.pts===t.pts?e.presortIndex-t.presortIndex:e.pts-t.pts}),this.captionPackets_.forEach(function(e){e.type<2?this.dispatchCea608Packet(e):this.dispatchCea708Packet(e)},this),this.captionPackets_.length=0,this.flushCCStreams(e)):this.flushCCStreams(e)},be.prototype.flush=function(){return this.flushStream("flush")},be.prototype.partialFlush=function(){return this.flushStream("partialFlush")},be.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(e){e.reset()})},be.prototype.dispatchCea608Packet=function(e){this.setsTextOrXDSActive(e)?this.activeCea608Channel_[e.type]=null:this.setsChannel1Active(e)?this.activeCea608Channel_[e.type]=0:this.setsChannel2Active(e)&&(this.activeCea608Channel_[e.type]=1),null!==this.activeCea608Channel_[e.type]&&this.ccStreams_[(e.type<<1)+this.activeCea608Channel_[e.type]].push(e)},be.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},be.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},be.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},be.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)};var Te={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},ke=function(e){return 32<=e&&e<=127||160<=e&&e<=255},Se=function(e){this.windowNum=e,this.reset()};Se.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},Se.prototype.getText=function(){return this.rows.join("\n")},Se.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Se.prototype.newLine=function(e){for(this.rows.length>=this.virtualRowCount&&"function"==typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Se.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Se.prototype.addText=function(e){this.rows[this.rowIdx]+=e},Se.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var we=function(e,t,n){this.serviceNum=e,this.text="",this.currentWindow=new Se(-1),this.windows=[],this.stream=n,"string"==typeof t&&this.createTextDecoder(t)};we.prototype.init=function(e,t){this.startPts=e;for(var n=0;n<8;n++)this.windows[n]=new Se(n),"function"==typeof t&&(this.windows[n].beforeRowOverflow=t)},we.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},we.prototype.createTextDecoder=function(e){if("undefined"==typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var Ee=function(e){e=e||{},Ee.prototype.init.call(this);var t,n=this,i=e.captionServices||{},r={};Object.keys(i).forEach(function(e){t=i[e],/^SERVICE/.test(e)&&(r[e]=t.encoding)}),this.serviceEncodings=r,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(n.new708Packet(),n.add708Bytes(e)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(e))}};Ee.prototype=new ye,Ee.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ee.prototype.add708Bytes=function(e){var t=e.ccData,n=t>>>8,i=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(n),this.current708Packet.data.push(i)},Ee.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,n=null,i=null,r=0,a=t[r++];for(e.seq=a>>6,e.sizeCode=63&a;r<t.length;r++)i=31&(a=t[r++]),7===(n=a>>5)&&i>0&&(n=a=t[r++]),this.pushServiceBlock(n,r,i),i>0&&(r+=i-1)},Ee.prototype.pushServiceBlock=function(e,t,n){var i,r=t,a=this.current708Packet.data,s=this.services[e];for(s||(s=this.initService(e,r));r<t+n&&r<a.length;r++)i=a[r],ke(i)?r=this.handleText(r,s):24===i?r=this.multiByteCharacter(r,s):16===i?r=this.extendedCommands(r,s):128<=i&&i<=135?r=this.setCurrentWindow(r,s):152<=i&&i<=159?r=this.defineWindow(r,s):136===i?r=this.clearWindows(r,s):140===i?r=this.deleteWindows(r,s):137===i?r=this.displayWindows(r,s):138===i?r=this.hideWindows(r,s):139===i?r=this.toggleWindows(r,s):151===i?r=this.setWindowAttributes(r,s):144===i?r=this.setPenAttributes(r,s):145===i?r=this.setPenColor(r,s):146===i?r=this.setPenLocation(r,s):143===i?s=this.reset(r,s):8===i?s.currentWindow.backspace():12===i?s.currentWindow.clearText():13===i?s.currentWindow.pendingNewLine=!0:14===i?s.currentWindow.clearText():141===i&&r++},Ee.prototype.extendedCommands=function(e,t){var n=this.current708Packet.data[++e];return ke(n)&&(e=this.handleText(e,t,{isExtended:!0})),e},Ee.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},Ee.prototype.initService=function(e,t){var n,i,r=this;return(n="SERVICE"+e)in this.serviceEncodings&&(i=this.serviceEncodings[n]),this.services[e]=new we(e,i,r),this.services[e].init(this.getPts(t),function(t){r.flushDisplayed(t,r.services[e])}),this.services[e]},Ee.prototype.handleText=function(e,t,n){var i,r,a,s,o=n&&n.isExtended,u=n&&n.isMultiByte,l=this.current708Packet.data,c=o?4096:0,d=l[e],h=l[e+1],p=t.currentWindow;if(u?(r=[d,h],e++):r=[d],t.textDecoder_&&!o)i=t.textDecoder_.decode(new Uint8Array(r));else if(u){var f=r.map(function(e){return("0"+(255&e).toString(16)).slice(-2)}).join("");i=String.fromCharCode(parseInt(f,16))}else s=Te[a=c|d]||a,i=4096&a&&a===s?"":String.fromCharCode(s);return p.pendingNewLine&&!p.isEmpty()&&p.newLine(this.getPts(e)),p.pendingNewLine=!1,p.addText(i),e},Ee.prototype.multiByteCharacter=function(e,t){var n=this.current708Packet.data,i=n[e+1],r=n[e+2];return ke(i)&&ke(r)&&(e=this.handleText(++e,t,{isMultiByte:!0})),e},Ee.prototype.setCurrentWindow=function(e,t){var n=7&this.current708Packet.data[e];return t.setCurrentWindow(n),e},Ee.prototype.defineWindow=function(e,t){var n=this.current708Packet.data,i=n[e],r=7&i;t.setCurrentWindow(r);var a=t.currentWindow;return i=n[++e],a.visible=(32&i)>>5,a.rowLock=(16&i)>>4,a.columnLock=(8&i)>>3,a.priority=7&i,i=n[++e],a.relativePositioning=(128&i)>>7,a.anchorVertical=127&i,i=n[++e],a.anchorHorizontal=i,i=n[++e],a.anchorPoint=(240&i)>>4,a.rowCount=15&i,i=n[++e],a.columnCount=63&i,i=n[++e],a.windowStyle=(56&i)>>3,a.penStyle=7&i,a.virtualRowCount=a.rowCount+1,e},Ee.prototype.setWindowAttributes=function(e,t){var n=this.current708Packet.data,i=n[e],r=t.currentWindow.winAttr;return i=n[++e],r.fillOpacity=(192&i)>>6,r.fillRed=(48&i)>>4,r.fillGreen=(12&i)>>2,r.fillBlue=3&i,i=n[++e],r.borderType=(192&i)>>6,r.borderRed=(48&i)>>4,r.borderGreen=(12&i)>>2,r.borderBlue=3&i,i=n[++e],r.borderType+=(128&i)>>5,r.wordWrap=(64&i)>>6,r.printDirection=(48&i)>>4,r.scrollDirection=(12&i)>>2,r.justify=3&i,i=n[++e],r.effectSpeed=(240&i)>>4,r.effectDirection=(12&i)>>2,r.displayEffect=3&i,e},Ee.prototype.flushDisplayed=function(e,t){for(var n=[],i=0;i<8;i++)t.windows[i].visible&&!t.windows[i].isEmpty()&&n.push(t.windows[i].getText());t.endPts=e,t.text=n.join("\n\n"),this.pushCaption(t),t.startPts=e},Ee.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},Ee.prototype.displayWindows=function(e,t){var n=this.current708Packet.data[++e],i=this.getPts(e);this.flushDisplayed(i,t);for(var r=0;r<8;r++)n&1<<r&&(t.windows[r].visible=1);return e},Ee.prototype.hideWindows=function(e,t){var n=this.current708Packet.data[++e],i=this.getPts(e);this.flushDisplayed(i,t);for(var r=0;r<8;r++)n&1<<r&&(t.windows[r].visible=0);return e},Ee.prototype.toggleWindows=function(e,t){var n=this.current708Packet.data[++e],i=this.getPts(e);this.flushDisplayed(i,t);for(var r=0;r<8;r++)n&1<<r&&(t.windows[r].visible^=1);return e},Ee.prototype.clearWindows=function(e,t){var n=this.current708Packet.data[++e],i=this.getPts(e);this.flushDisplayed(i,t);for(var r=0;r<8;r++)n&1<<r&&t.windows[r].clearText();return e},Ee.prototype.deleteWindows=function(e,t){var n=this.current708Packet.data[++e],i=this.getPts(e);this.flushDisplayed(i,t);for(var r=0;r<8;r++)n&1<<r&&t.windows[r].reset();return e},Ee.prototype.setPenAttributes=function(e,t){var n=this.current708Packet.data,i=n[e],r=t.currentWindow.penAttr;return i=n[++e],r.textTag=(240&i)>>4,r.offset=(12&i)>>2,r.penSize=3&i,i=n[++e],r.italics=(128&i)>>7,r.underline=(64&i)>>6,r.edgeType=(56&i)>>3,r.fontStyle=7&i,e},Ee.prototype.setPenColor=function(e,t){var n=this.current708Packet.data,i=n[e],r=t.currentWindow.penColor;return i=n[++e],r.fgOpacity=(192&i)>>6,r.fgRed=(48&i)>>4,r.fgGreen=(12&i)>>2,r.fgBlue=3&i,i=n[++e],r.bgOpacity=(192&i)>>6,r.bgRed=(48&i)>>4,r.bgGreen=(12&i)>>2,r.bgBlue=3&i,i=n[++e],r.edgeRed=(48&i)>>4,r.edgeGreen=(12&i)>>2,r.edgeBlue=3&i,e},Ee.prototype.setPenLocation=function(e,t){var n=this.current708Packet.data,i=n[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,i=n[++e],r.row=15&i,i=n[++e],r.column=63&i,e},Ee.prototype.reset=function(e,t){var n=this.getPts(e);return this.flushDisplayed(n,t),this.initService(t.serviceNum,e)};var Ce={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},Ae=function(e){return null===e?"":(e=Ce[e]||e,String.fromCharCode(e))},Ie=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],xe=function(){for(var e=[],t=15;t--;)e.push({text:"",indent:0,offset:0});return e},Le=function(e,t){Le.prototype.init.call(this),this.field_=e||0,this.dataChannel_=t||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,n,i,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096==(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),i=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),n=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=n,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?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(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=xe();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=xe();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=xe()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(i,r))a=Ae((i=(3&i)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(i,r))"popOn"===this.mode_?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),a=Ae((i=(3&i)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(i,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14&~r||this.addFormatting(e.pts,["i"]),1&~r||this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(i,r)){var s=3&r;this.nonDisplayed_[this.row_].offset=s,this.column_+=s}else if(this.isPAC(i,r)){var o=Ie.indexOf(7968&t);if("rollUp"===this.mode_&&(o-this.rollUpRows_+1<0&&(o=this.rollUpRows_-1),this.setRollUp(e.pts,o)),o!==this.row_&&o>=0&&o<=14&&(this.clearFormatting(e.pts),this.row_=o),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),!(16&~t)){var u=(14&t)>>1;this.column_=4*u,this.nonDisplayed_[this.row_].indent+=u}this.isColorPAC(r)&&(14&~r||this.addFormatting(e.pts,["i"]))}else this.isNormalChar(i)&&(0===r&&(r=null),a=Ae(i),a+=Ae(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Le.prototype=new ye,Le.prototype.flushDisplayed=function(e){var t=this,n=function(e){t.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+e+"."})},i=[];this.displayed_.forEach(function(e,t){if(e&&e.text&&e.text.length){try{e.text=e.text.trim()}catch(vy){n(t)}e.text.length&&i.push({text:e.text,line:t+1,position:10+Math.min(70,10*e.indent)+2.5*e.offset})}else null==e&&n(t)}),i.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,content:i,stream:this.name_})},Le.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=xe(),this.nonDisplayed_=xe(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Le.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Le.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Le.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Le.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Le.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Le.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&t>=64&&t<=127},Le.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Le.prototype.isNormalChar=function(e){return e>=32&&e<=127},Le.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=xe(),this.displayed_=xe()),void 0!==t&&t!==this.row_)for(var n=0;n<this.rollUpRows_;n++)this.displayed_[t-n]=this.displayed_[this.row_-n],this.displayed_[this.row_-n]={text:"",indent:0,offset:0};void 0===t&&(t=this.row_),this.topRow_=t-this.rollUpRows_+1},Le.prototype.addFormatting=function(e,t){this.formatting_=this.formatting_.concat(t);var n=t.reduce(function(e,t){return e+"<"+t+">"},"");this[this.mode_](e,n)},Le.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(e,t){return e+"</"+t+">"},"");this.formatting_=[],this[this.mode_](e,t)}},Le.prototype.popOn=function(e,t){var n=this.nonDisplayed_[this.row_].text;n+=t,this.nonDisplayed_[this.row_].text=n},Le.prototype.rollUp=function(e,t){var n=this.displayed_[this.row_].text;n+=t,this.displayed_[this.row_].text=n},Le.prototype.shiftRowsUp_=function(){var e;for(e=0;e<this.topRow_;e++)this.displayed_[e]={text:"",indent:0,offset:0};for(e=this.row_+1;e<15;e++)this.displayed_[e]={text:"",indent:0,offset:0};for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Le.prototype.paintOn=function(e,t){var n=this.displayed_[this.row_].text;n+=t,this.displayed_[this.row_].text=n};var De={CaptionStream:be,Cea608Stream:Le,Cea708Stream:Ee},Pe={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Re=G,Oe="shared",Ne=function(e,t){var n=1;for(e>t&&(n=-1);Math.abs(t-e)>4294967296;)e+=8589934592*n;return e},Ue=function(e){var t,n;Ue.prototype.init.call(this),this.type_=e||Oe,this.push=function(e){"metadata"!==e.type?this.type_!==Oe&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=Ne(e.dts,n),e.pts=Ne(e.pts,n),t=e.dts,this.trigger("data",e)):this.trigger("data",e)},this.flush=function(){n=t,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,t=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ue.prototype=new Re;var Me,Be={TimestampRolloverStream:Ue,handleRollover:Ne},je=function(e,t,n){if(!e)return-1;for(var i=n;i<e.length;i++)if(e[i]===t)return i;return-1},Fe=3,qe=function(e,t,n){var i,r="";for(i=t;i<n;i++)r+="%"+("00"+e[i].toString(16)).slice(-2);return r},Ve=function(e,t,n){return decodeURIComponent(qe(e,t,n))},He=function(e,t,n){return unescape(qe(e,t,n))},ze=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},We={APIC:function(e){var t,n,i=1;e.data[0]===Fe&&((t=je(e.data,0,i))<0||(e.mimeType=He(e.data,i,t),i=t+1,e.pictureType=e.data[i],i++,(n=je(e.data,0,i))<0||(e.description=Ve(e.data,i,n),i=n+1,"--\x3e"===e.mimeType?e.url=He(e.data,i,e.data.length):e.pictureData=e.data.subarray(i,e.data.length))))},"T*":function(e){e.data[0]===Fe&&(e.value=Ve(e.data,1,e.data.length).replace(/\0*$/,""),e.values=e.value.split("\0"))},TXXX:function(e){var t;e.data[0]===Fe&&-1!==(t=je(e.data,0,1))&&(e.description=Ve(e.data,1,t),e.value=Ve(e.data,t+1,e.data.length).replace(/\0*$/,""),e.data=e.value)},"W*":function(e){e.url=He(e.data,0,e.data.length).replace(/\0.*$/,"")},WXXX:function(e){var t;e.data[0]===Fe&&-1!==(t=je(e.data,0,1))&&(e.description=Ve(e.data,1,t),e.url=He(e.data,t+1,e.data.length).replace(/\0.*$/,""))},PRIV:function(e){var t;for(t=0;t<e.data.length;t++)if(0===e.data[t]){e.owner=He(e.data,0,t);break}e.privateData=e.data.subarray(t+1),e.data=e.privateData}},Ge={parseId3Frames:function(e){var t,n=10,i=0,r=[];if(!(e.length<10||e[0]!=="I".charCodeAt(0)||e[1]!=="D".charCodeAt(0)||e[2]!=="3".charCodeAt(0))){i=ze(e.subarray(6,10)),i+=10,64&e[5]&&(n+=4,n+=ze(e.subarray(10,14)),i-=ze(e.subarray(16,20)));do{if((t=ze(e.subarray(n+4,n+8)))<1)break;var a={id:String.fromCharCode(e[n],e[n+1],e[n+2],e[n+3]),data:e.subarray(n+10,n+t+10)};a.key=a.id,We[a.id]?We[a.id](a):"T"===a.id[0]?We["T*"](a):"W"===a.id[0]&&We["W*"](a),r.push(a),n+=10,n+=t}while(n<i);return r}},parseSyncSafeInteger:ze,frameParsers:We},Xe=G,Ke=Pe,Ye=Ge;Me=function(e){var t,n={descriptor:e&&e.descriptor},i=0,r=[],a=0;if(Me.prototype.init.call(this),this.dispatchType=Ke.METADATA_STREAM_TYPE.toString(16),n.descriptor)for(t=0;t<n.descriptor.length;t++)this.dispatchType+=("00"+n.descriptor[t].toString(16)).slice(-2);this.push=function(e){var t,n,s,o,u;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(a=0,r.length=0),0===r.length&&(e.data.length<10||e.data[0]!=="I".charCodeAt(0)||e.data[1]!=="D".charCodeAt(0)||e.data[2]!=="3".charCodeAt(0)))this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});else if(r.push(e),a+=e.data.byteLength,1===r.length&&(i=Ye.parseSyncSafeInteger(e.data.subarray(6,10)),i+=10),!(a<i)){for(t={data:new Uint8Array(i),frames:[],pts:r[0].pts,dts:r[0].dts},u=0;u<i;)t.data.set(r[0].data.subarray(0,i-u),u),u+=r[0].data.byteLength,a-=r[0].data.byteLength,r.shift();n=10,64&t.data[5]&&(n+=4,n+=Ye.parseSyncSafeInteger(t.data.subarray(10,14)),i-=Ye.parseSyncSafeInteger(t.data.subarray(16,20)));do{if((s=Ye.parseSyncSafeInteger(t.data.subarray(n+4,n+8)))<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if((o={id:String.fromCharCode(t.data[n],t.data[n+1],t.data[n+2],t.data[n+3]),data:t.data.subarray(n+10,n+s+10)}).key=o.id,Ye.frameParsers[o.id]?Ye.frameParsers[o.id](o):"T"===o.id[0]?Ye.frameParsers["T*"](o):"W"===o.id[0]&&Ye.frameParsers["W*"](o),"com.apple.streaming.transportStreamTimestamp"===o.owner){var l=o.data,c=(1&l[3])<<30|l[4]<<22|l[5]<<14|l[6]<<6|l[7]>>>2;c*=4,c+=3&l[7],o.timeStamp=c,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),n+=10,n+=s}while(n<i);this.trigger("data",t)}}},Me.prototype=new Xe;var Qe,$e,Je,Ze=Me,et=G,tt=De,nt=Pe,it=Be.TimestampRolloverStream,rt=188;(Qe=function(){var e=new Uint8Array(rt),t=0;Qe.prototype.init.call(this),this.push=function(n){var i,r=0,a=rt;for(t?((i=new Uint8Array(n.byteLength+t)).set(e.subarray(0,t)),i.set(n,t),t=0):i=n;a<i.byteLength;)71!==i[r]||71!==i[a]?(r++,a++):(this.trigger("data",i.subarray(r,a)),r+=rt,a+=rt);r<i.byteLength&&(e.set(i.subarray(r),0),t=i.byteLength-r)},this.flush=function(){t===rt&&71===e[0]&&(this.trigger("data",e),t=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){t=0,this.trigger("reset")}}).prototype=new et,$e=function(){var e,t,n,i;$e.prototype.init.call(this),i=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,e=function(e,i){var r=0;i.payloadUnitStartIndicator&&(r+=e[r]+1),"pat"===i.type?t(e.subarray(r),i):n(e.subarray(r),i)},t=function(e,t){t.section_number=e[7],t.last_section_number=e[8],i.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=i.pmtPid},n=function(e,t){var n,r;if(1&e[5]){for(i.programMapTable={video:null,audio:null,"timed-metadata":{}},n=3+((15&e[1])<<8|e[2])-4,r=12+((15&e[10])<<8|e[11]);r<n;){var a=e[r],s=(31&e[r+1])<<8|e[r+2];a===nt.H264_STREAM_TYPE&&null===i.programMapTable.video?i.programMapTable.video=s:a===nt.ADTS_STREAM_TYPE&&null===i.programMapTable.audio?i.programMapTable.audio=s:a===nt.METADATA_STREAM_TYPE&&(i.programMapTable["timed-metadata"][s]=a),r+=5+((15&e[r+3])<<8|e[r+4])}t.programMapTable=i.programMapTable}},this.push=function(t){var n={},i=4;if(n.payloadUnitStartIndicator=!!(64&t[1]),n.pid=31&t[1],n.pid<<=8,n.pid|=t[2],(48&t[3])>>>4>1&&(i+=t[i]+1),0===n.pid)n.type="pat",e(t.subarray(i),n),this.trigger("data",n);else if(n.pid===this.pmtPid)for(n.type="pmt",e(t.subarray(i),n),this.trigger("data",n);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,i,n]):this.processPes_(t,i,n)},this.processPes_=function(e,t,n){n.pid===this.programMapTable.video?n.streamType=nt.H264_STREAM_TYPE:n.pid===this.programMapTable.audio?n.streamType=nt.ADTS_STREAM_TYPE:n.streamType=this.programMapTable["timed-metadata"][n.pid],n.type="pes",n.data=e.subarray(t),this.trigger("data",n)}},$e.prototype=new et,$e.STREAM_TYPES={h264:27,adts:15},Je=function(){var e,t=this,n=!1,i={data:[],size:0},r={data:[],size:0},a={data:[],size:0},s=function(e,n,i){var r,a,s=new Uint8Array(e.size),o={type:n},u=0,l=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,u=0;u<e.data.length;u++)a=e.data[u],s.set(a.data,l),l+=a.data.byteLength;var c,d,h,p;d=o,p=(c=s)[0]<<16|c[1]<<8|c[2],d.data=new Uint8Array,1===p&&(d.packetLength=6+(c[4]<<8|c[5]),d.dataAlignmentIndicator=!!(4&c[6]),192&(h=c[7])&&(d.pts=(14&c[9])<<27|(255&c[10])<<20|(254&c[11])<<12|(255&c[12])<<5|(254&c[13])>>>3,d.pts*=4,d.pts+=(6&c[13])>>>1,d.dts=d.pts,64&h&&(d.dts=(14&c[14])<<27|(255&c[15])<<20|(254&c[16])<<12|(255&c[17])<<5|(254&c[18])>>>3,d.dts*=4,d.dts+=(6&c[18])>>>1)),d.data=c.subarray(9+c[8])),r="video"===n||o.packetLength<=e.size,(i||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",o)}};Je.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var e,t;switch(o.streamType){case nt.H264_STREAM_TYPE:e=i,t="video";break;case nt.ADTS_STREAM_TYPE:e=r,t="audio";break;case nt.METADATA_STREAM_TYPE:e=a,t="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(o),e.size+=o.data.byteLength},pmt:function(){var i={type:"metadata",tracks:[]};null!==(e=o.programMapTable).video&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),n=!0,t.trigger("data",i)}})[o.type]()},this.reset=function(){i.size=0,i.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(i,"video"),s(r,"audio"),s(a,"timed-metadata")},this.flush=function(){if(!n&&e){var i={type:"metadata",tracks:[]};null!==e.video&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&i.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",i)}n=!1,this.flushStreams_(),this.trigger("done")}},Je.prototype=new et;var at={PAT_PID:0,MP2T_PACKET_LENGTH:rt,TransportPacketStream:Qe,TransportParseStream:$e,ElementaryStream:Je,TimestampRolloverStream:it,CaptionStream:tt.CaptionStream,Cea608Stream:tt.Cea608Stream,Cea708Stream:tt.Cea708Stream,MetadataStream:Ze};for(var st in nt)nt.hasOwnProperty(st)&&(at[st]=nt[st]);var ot,ut=at,lt=G,ct=de.ONE_SECOND_IN_TS,dt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];ot=function(e){var t,n=0;ot.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes ".concat(e," to ").concat(t," in frame ").concat(n," outside syncword")})},this.push=function(i){var r,a,s,o,u,l=0;if(e||(n=0),"audio"===i.type){var c;for(t&&t.length?(s=t,(t=new Uint8Array(s.byteLength+i.data.byteLength)).set(s),t.set(i.data,s.byteLength)):t=i.data;l+7<t.length;)if(255===t[l]&&240==(246&t[l+1])){if("number"==typeof c&&(this.skipWarn_(c,l),c=null),a=2*(1&~t[l+1]),r=(3&t[l+3])<<11|t[l+4]<<3|(224&t[l+5])>>5,u=(o=1024*(1+(3&t[l+6])))*ct/dt[(60&t[l+2])>>>2],t.byteLength-l<r)break;this.trigger("data",{pts:i.pts+n*u,dts:i.dts+n*u,sampleCount:o,audioobjecttype:1+(t[l+2]>>>6&3),channelcount:(1&t[l+2])<<2|(192&t[l+3])>>>6,samplerate:dt[(60&t[l+2])>>>2],samplingfrequencyindex:(60&t[l+2])>>>2,samplesize:16,data:t.subarray(l+7+a,l+r)}),n++,l+=r}else"number"!=typeof c&&(c=l),l++;"number"==typeof c&&(this.skipWarn_(c,l),c=null),t=t.subarray(l)}},this.flush=function(){n=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}},ot.prototype=new lt;var ht,pt,ft,mt=ot,gt=G,vt=function(e){var t=e.byteLength,n=0,i=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+i},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),n=new DataView(a.buffer).getUint32(0),i=8*s,t-=s},this.skipBits=function(e){var r;i>e?(n<<=e,i-=e):(e-=i,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),n<<=e,i-=e)},this.readBits=function(e){var r=Math.min(i,e),a=n>>>32-r;return(i-=r)>0?n<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<<r|this.readBits(r):a},this.skipLeadingZeros=function(){var e;for(e=0;e<i;++e)if(n&2147483648>>>e)return n<<=e,i-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};pt=function(){var e,t,n=0;pt.prototype.init.call(this),this.push=function(i){var r;t?((r=new Uint8Array(t.byteLength+i.data.byteLength)).set(t),r.set(i.data,t.byteLength),t=r):t=i.data;for(var a=t.byteLength;n<a-3;n++)if(1===t[n+2]){e=n+5;break}for(;e<a;)switch(t[e]){case 0:if(0!==t[e-1]){e+=2;break}if(0!==t[e-2]){e++;break}n+3!==e-2&&this.trigger("data",t.subarray(n+3,e-2));do{e++}while(1!==t[e]&&e<a);n=e-2,e+=3;break;case 1:if(0!==t[e-1]||0!==t[e-2]){e+=3;break}this.trigger("data",t.subarray(n+3,e-2)),n=e-2,e+=3;break;default:e+=3}t=t.subarray(n),e-=n,n=0},this.reset=function(){t=null,n=0,this.trigger("reset")},this.flush=function(){t&&t.byteLength>3&&this.trigger("data",t.subarray(n+3)),t=null,n=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},pt.prototype=new gt,ft={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},ht=function(){var e,t,n,i,r,a,s,o=new pt;ht.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,n=e.pts,i=e.dts,o.push(e))},o.on("data",function(s){var o={trackId:t,pts:n,dts:i,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)}),o.on("done",function(){e.trigger("done")}),o.on("partialdone",function(){e.trigger("partialdone")}),o.on("reset",function(){e.trigger("reset")}),o.on("endedtimeline",function(){e.trigger("endedtimeline")}),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(e,t){var n,i=8,r=8;for(n=0;n<e;n++)0!==r&&(r=(i+t.readExpGolomb()+256)%256),i=0===r?i:r},r=function(e){for(var t,n,i=e.byteLength,r=[],a=1;a<i-2;)0===e[a]&&0===e[a+1]&&3===e[a+2]?(r.push(a+2),a+=2):a++;if(0===r.length)return e;t=i-r.length,n=new Uint8Array(t);var s=0;for(a=0;a<t;s++,a++)s===r[0]&&(s++,r.shift()),n[a]=e[s];return n},a=function(e){var t,n,i,r,a,o,u,l,c,d,h,p,f=0,m=0,g=0,v=0,y=[1,1];if(n=(t=new vt(e)).readUnsignedByte(),r=t.readUnsignedByte(),i=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),ft[n]&&(3===(a=t.readUnsignedExpGolomb())&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(h=3!==a?8:12,p=0;p<h;p++)t.readBoolean()&&s(p<6?16:64,t);if(t.skipUnsignedExpGolomb(),0===(o=t.readUnsignedExpGolomb()))t.readUnsignedExpGolomb();else if(1===o)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),u=t.readUnsignedExpGolomb(),p=0;p<u;p++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),l=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),0===(d=t.readBits(1))&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(f=t.readUnsignedExpGolomb(),m=t.readUnsignedExpGolomb(),g=t.readUnsignedExpGolomb(),v=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){switch(t.readUnsignedByte()){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:y=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}y&&(y[0],y[1])}return{profileIdc:n,levelIdc:i,profileCompatibility:r,width:16*(l+1)-2*f-2*m,height:(2-d)*(c+1)*16-2*g-2*v,sarRatio:y}}},ht.prototype=new gt;var yt,_t={H264Stream:ht,NalByteStream:pt},bt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Tt=function(e,t){var n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return n=n>=0?n:0,(16&e[t+5])>>4?n+20:n+10},kt=function(e,t){return e.length-t<10||e[t]!=="I".charCodeAt(0)||e[t+1]!=="D".charCodeAt(0)||e[t+2]!=="3".charCodeAt(0)?t:(t+=Tt(e,t),kt(e,t))},St=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},wt=function(e,t,n){return unescape(function(e,t,n){var i,r="";for(i=t;i<n;i++)r+="%"+("00"+e[i].toString(16)).slice(-2);return r}(e,t,n))},Et={isLikelyAacData:function(e){var t=kt(e,0);return e.length>=t+2&&!(255&~e[t])&&!(240&~e[t+1])&&16==(22&e[t+1])},parseId3TagSize:Tt,parseAdtsSize:function(e,t){var n=(224&e[t+5])>>5,i=e[t+4]<<3;return 6144&e[t+3]|i|n},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&!(240&~e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5<e.length;){if(255===e[t]&&240==(246&e[t+1]))return bt[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,n,i;t=10,64&e[5]&&(t+=4,t+=St(e.subarray(10,14)));do{if((n=St(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){i=e.subarray(t+10,t+n+10);for(var r=0;r<i.byteLength;r++)if(0===i[r]){if("com.apple.streaming.transportStreamTimestamp"===wt(i,0,r)){var a=i.subarray(r+1),s=(1&a[3])<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2;return s*=4,s+=3&a[7]}break}}t+=10,t+=n}while(t<e.byteLength);return null}},Ct=Et;(yt=function(){var e=new Uint8Array,t=0;yt.prototype.init.call(this),this.setTimestamp=function(e){t=e},this.push=function(n){var i,r,a,s,o=0,u=0;for(e.length?(s=e.length,(e=new Uint8Array(n.byteLength+s)).set(e.subarray(0,s)),e.set(n,s)):e=n;e.length-u>=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255&~e[u]||240&~e[u+1])u++;else{if(e.length-u<7)break;if(u+(o=Ct.parseAdtsSize(e,u))>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else{if(e.length-u<10)break;if(u+(o=Ct.parseId3TagSize(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}i=e.length-u,e=i>0?e.subarray(u):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new G;var At,It,xt,Lt,Dt=G,Pt=re,Rt=se,Ot=fe,Nt=ge,Ut=ut,Mt=de,Bt=mt,jt=_t.H264Stream,Ft=yt,qt=Et.isLikelyAacData,Vt=de.ONE_SECOND_IN_TS,Ht=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],zt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Wt=function(e,t){t.stream=e,this.trigger("log",t)},Gt=function(e,t){for(var n=Object.keys(t),i=0;i<n.length;i++){var r=n[i];"headOfPipeline"!==r&&t[r].on&&t[r].on("log",Wt.bind(e,r))}},Xt=function(e,t){var n;if(e.length!==t.length)return!1;for(n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0},Kt=function(e,t,n,i,r,a){return{start:{dts:e,pts:e+(n-t)},end:{dts:e+(i-t),pts:e+(r-n)},prependedContentDuration:a,baseMediaDecodeTime:e}};(It=function(e,t){var n,i=[],r=0,a=0,s=1/0;n=(t=t||{}).firstSequenceNumber||0,It.prototype.init.call(this),this.push=function(t){Nt.collectDtsInfo(e,t),e&&Ht.forEach(function(n){e[n]=t[n]}),i.push(t)},this.setEarliestDts=function(e){r=e},this.setVideoBaseMediaDecodeTime=function(e){s=e},this.setAudioAppendStart=function(e){a=e},this.flush=function(){var o,u,l,c,d,h,p;0!==i.length?(o=Ot.trimAdtsFramesByEarliestDts(i,e,r),e.baseMediaDecodeTime=Nt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),p=Ot.prefixWithSilence(e,o,a,s),e.samples=Ot.generateSampleTable(o),l=Pt.mdat(Ot.concatenateFrameData(o)),i=[],u=Pt.moof(n,[e]),c=new Uint8Array(u.byteLength+l.byteLength),n++,c.set(u),c.set(l,u.byteLength),Nt.clearDtsInfo(e),d=Math.ceil(1024*Vt/e.samplerate),o.length&&(h=o.length*d,this.trigger("segmentTimingInfo",Kt(Mt.audioTsToVideoTs(e.baseMediaDecodeTime,e.samplerate),o[0].dts,o[0].pts,o[0].dts+h,o[0].pts+h,p||0)),this.trigger("timingInfo",{start:o[0].pts,end:o[0].pts+h})),this.trigger("data",{track:e,boxes:c}),this.trigger("done","AudioSegmentStream")):this.trigger("done","AudioSegmentStream")},this.reset=function(){Nt.clearDtsInfo(e),i=[],this.trigger("reset")}}).prototype=new Dt,At=function(e,t){var n,i,r,a=[],s=[];n=(t=t||{}).firstSequenceNumber||0,At.prototype.init.call(this),delete e.minPTS,this.gopCache_=[],this.push=function(t){Nt.collectDtsInfo(e,t),"seq_parameter_set_rbsp"!==t.nalUnitType||i||(i=t.config,e.sps=[t.data],zt.forEach(function(t){e[t]=i[t]},this)),"pic_parameter_set_rbsp"!==t.nalUnitType||r||(r=t.data,e.pps=[t.data]),a.push(t)},this.flush=function(){for(var i,r,o,u,l,c,d,h,p=0;a.length&&"access_unit_delimiter_rbsp"!==a[0].nalUnitType;)a.shift();if(0===a.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(i=Rt.groupNalsIntoFrames(a),(o=Rt.groupFramesIntoGops(i))[0][0].keyFrame||((r=this.getGopForFusion_(a[0],e))?(p=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=Rt.extendFirstKeyFrame(o)),s.length){var f;if(!(f=t.alignGopsAtEnd?this.alignGopsAtEnd_(o):this.alignGopsAtStart_(o)))return this.gopCache_.unshift({gop:o.pop(),pps:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");Nt.clearDtsInfo(e),o=f}Nt.collectDtsInfo(e,o),e.samples=Rt.generateSampleTable(o),l=Pt.mdat(Rt.concatenateNalData(o)),e.baseMediaDecodeTime=Nt.calculateTrackBaseMediaDecodeTime(e,t.keepOriginalTimestamps),this.trigger("processedGopsInfo",o.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}})),d=o[0],h=o[o.length-1],this.trigger("segmentTimingInfo",Kt(e.baseMediaDecodeTime,d.dts,d.pts,h.dts+h.duration,h.pts+h.duration,p)),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:e.pps,sps:e.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),a=[],this.trigger("baseMediaDecodeTime",e.baseMediaDecodeTime),this.trigger("timelineStartInfo",e.timelineStartInfo),u=Pt.moof(n,[e]),c=new Uint8Array(u.byteLength+l.byteLength),n++,c.set(u),c.set(l,u.byteLength),this.trigger("data",{track:e,boxes:c}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),a=[],this.gopCache_.length=0,s.length=0,this.trigger("reset")},this.resetStream_=function(){Nt.clearDtsInfo(e),i=void 0,r=void 0},this.getGopForFusion_=function(t){var n,i,r,a,s,o=1/0;for(s=0;s<this.gopCache_.length;s++)r=(a=this.gopCache_[s]).gop,e.pps&&Xt(e.pps[0],a.pps[0])&&e.sps&&Xt(e.sps[0],a.sps[0])&&(r.dts<e.timelineStartInfo.dts||(n=t.dts-r.dts-r.duration)>=-1e4&&n<=45e3&&(!i||o>n)&&(i=a,o=n));return i?i.gop:null},this.alignGopsAtStart_=function(e){var t,n,i,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=n=0;t<s.length&&n<e.length&&(i=s[t],r=e[n],i.pts!==r.pts);)r.pts>i.pts?t++:(n++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===n?e:n===e.length?null:((l=e.slice(n)).byteLength=a,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,n,i,r,a,o,u;for(t=s.length-1,n=e.length-1,a=null,o=!1;t>=0&&n>=0;){if(i=s[t],r=e[n],i.pts===r.pts){o=!0;break}i.pts>r.pts?t--:(t===s.length-1&&(a=n),n--)}if(!o&&null===a)return null;if(0===(u=o?n:a))return e;var l=e.slice(u),c=l.reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0});return l.byteLength=c.byteLength,l.duration=c.duration,l.nalCount=c.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){s=e}},At.prototype=new Dt,(Lt=function(e,t){this.numberOfTracks=0,this.metadataStream=t,void 0!==(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"==typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Lt.prototype.init.call(this),this.push=function(e){return e.content||e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new Dt,Lt.prototype.flush=function(e){var t,n,i,r,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length<this.numberOfTracks){if("VideoSegmentStream"!==e&&"AudioSegmentStream"!==e)return;if(this.remuxTracks)return;if(0===this.pendingTracks.length)return this.emittedTracks++,void(this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,zt.forEach(function(e){s.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,Ht.forEach(function(e){s.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,i=Pt.initSegment(this.pendingTracks),s.initSegment=new Uint8Array(i.byteLength),s.initSegment.set(i),s.data=new Uint8Array(this.pendingBytes),r=0;r<this.pendingBoxes.length;r++)s.data.set(this.pendingBoxes[r],a),a+=this.pendingBoxes[r].byteLength;for(r=0;r<this.pendingCaptions.length;r++)(t=this.pendingCaptions[r]).startTime=Mt.metadataTsToSeconds(t.startPts,o,this.keepOriginalTimestamps),t.endTime=Mt.metadataTsToSeconds(t.endPts,o,this.keepOriginalTimestamps),s.captionStreams[t.stream]=!0,s.captions.push(t);for(r=0;r<this.pendingMetadata.length;r++)(n=this.pendingMetadata[r]).cueTime=Mt.metadataTsToSeconds(n.pts,o,this.keepOriginalTimestamps),s.metadata.push(n);for(s.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",s),r=0;r<s.captions.length;r++)t=s.captions[r],this.trigger("caption",t);for(r=0;r<s.metadata.length;r++)n=s.metadata[r],this.trigger("id3Frame",n)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Lt.prototype.setRemux=function(e){this.remuxTracks=e},xt=function(e){var t,n,i=this,r=!0;xt.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new Ut.MetadataStream,r.aacStream=new Ft,r.audioTimestampRolloverStream=new Ut.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new Ut.TimestampRolloverStream("timed-metadata"),r.adtsStream=new Bt,r.coalesceStream=new Lt(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",function(e){r.aacStream.setTimestamp(e.timeStamp)}),r.aacStream.on("data",function(a){"timed-metadata"!==a.type&&"audio"!==a.type||r.audioSegmentStream||(n=n||{timelineStartInfo:{baseMediaDecodeTime:i.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new It(n,e),r.audioSegmentStream.on("log",i.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",i.trigger.bind(i,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),i.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!t}))}),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Gt(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new Ut.MetadataStream,r.packetStream=new Ut.TransportPacketStream,r.parseStream=new Ut.TransportParseStream,r.elementaryStream=new Ut.ElementaryStream,r.timestampRolloverStream=new Ut.TimestampRolloverStream,r.adtsStream=new Bt,r.h264Stream=new jt,r.captionStream=new Ut.CaptionStream(e),r.coalesceStream=new Lt(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?n||"audio"!==a.tracks[s].type||((n=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new At(t,e),r.videoSegmentStream.on("log",i.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",function(t){n&&!e.keepOriginalTimestamps&&(n.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-i.baseMediaDecodeTime))}),r.videoSegmentStream.on("processedGopsInfo",i.trigger.bind(i,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",i.trigger.bind(i,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",function(e){n&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),r.videoSegmentStream.on("timingInfo",i.trigger.bind(i,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),n&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new It(n,e),r.audioSegmentStream.on("log",i.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",i.trigger.bind(i,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",i.trigger.bind(i,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),i.trigger("trackinfo",{hasAudio:!!n,hasVideo:!!t})}}),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",function(e){e.dispatchType=r.metadataStream.dispatchType,i.trigger("id3Frame",e)}),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Gt(this,r)},this.setBaseMediaDecodeTime=function(i){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=i),n&&(n.timelineStartInfo.dts=void 0,n.timelineStartInfo.pts=void 0,Nt.clearDtsInfo(n),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,Nt.clearDtsInfo(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){n&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var n=this.transmuxPipeline_;e.remux=t,n&&n.coalesceStream&&n.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(n){n.stream=e,t.trigger("log",n)}},this.push=function(e){if(r){var t=qt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!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()}},xt.prototype=new Dt;var Yt,Qt,$t={Transmuxer:xt,VideoSegmentStream:At,AudioSegmentStream:It,AUDIO_PROPERTIES:Ht,VIDEO_PROPERTIES:zt,generateSegmentTimingInfo:Kt},Jt=function(e){return e>>>0},Zt=function(e){return("00"+e.toString(16)).slice(-2)},en=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},tn=Jt,nn=en,rn=function(e,t){var n,i,r,a,s,o=[];if(!t.length)return null;for(n=0;n<e.byteLength;)i=tn(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3]),r=nn(e.subarray(n+4,n+8)),a=i>1?n+i:e.byteLength,r===t[0]&&(1===t.length?o.push(e.subarray(n+8,a)):(s=rn(e.subarray(n+8,a),t.slice(1))).length&&(o=o.concat(s))),n=a;return o},an=rn,sn=Jt,on=K.getUint64,un=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=on(e.subarray(4)):t.baseMediaDecodeTime=sn(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},ln=function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:n.getUint32(4)},r=1&i.flags[2],a=2&i.flags[2],s=8&i.flags[2],o=16&i.flags[2],u=32&i.flags[2],l=65536&i.flags[0],c=131072&i.flags[0];return t=8,r&&(t+=4,i.baseDataOffset=n.getUint32(12),t+=4),a&&(i.sampleDescriptionIndex=n.getUint32(t),t+=4),s&&(i.defaultSampleDuration=n.getUint32(t),t+=4),o&&(i.defaultSampleSize=n.getUint32(t),t+=4),u&&(i.defaultSampleFlags=n.getUint32(t)),l&&(i.durationIsEmpty=!0),!r&&c&&(i.baseDataOffsetIsMoof=!0),i},cn=K.getUint64,dn=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8)},i=12;0===n.version?(n.earliestPresentationTime=t.getUint32(i),n.firstOffset=t.getUint32(i+4),i+=8):(n.earliestPresentationTime=cn(e.subarray(i)),n.firstOffset=cn(e.subarray(i+8)),i+=16),i+=2;var r=t.getUint16(i);for(i+=2;r>0;i+=12,r--)n.references.push({referenceType:(128&e[i])>>>7,referencedSize:2147483647&t.getUint32(i),subsegmentDuration:t.getUint32(i+4),startsWithSap:!!(128&e[i+8]),sapType:(112&e[i+8])>>>4,sapDeltaTime:268435455&t.getUint32(i+8)});return n},hn=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},pn=function(e){var t,n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&n.flags[2],a=4&n.flags[2],s=1&n.flags[1],o=2&n.flags[1],u=4&n.flags[1],l=8&n.flags[1],c=i.getUint32(4),d=8;for(r&&(n.dataOffset=i.getInt32(d),d+=4),a&&c&&(t={flags:hn(e.subarray(d,d+4))},d+=4,s&&(t.duration=i.getUint32(d),d+=4),o&&(t.size=i.getUint32(d),d+=4),l&&(1===n.version?t.compositionTimeOffset=i.getInt32(d):t.compositionTimeOffset=i.getUint32(d),d+=4),n.samples.push(t),c--);c--;)t={},s&&(t.duration=i.getUint32(d),d+=4),o&&(t.size=i.getUint32(d),d+=4),u&&(t.flags=hn(e.subarray(d,d+4)),d+=4),l&&(1===n.version?t.compositionTimeOffset=i.getInt32(d):t.compositionTimeOffset=i.getUint32(d),d+=4),n.samples.push(t);return n},fn=K.getUint64,mn=function(e){return new Date(1e3*e-20828448e5)},gn=en,vn=function(e){var t,n,i=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[];for(t=0;t+4<e.length;t+=n)if(n=i.getUint32(t),t+=4,n<=0)r.push("<span style='color:red;'>MALFORMED DATA</span>");else switch(31&e[t]){case 1:r.push("slice_layer_without_partitioning_rbsp");break;case 5:r.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:r.push("sei_rbsp");break;case 7:r.push("seq_parameter_set_rbsp");break;case 8:r.push("pic_parameter_set_rbsp");break;case 9:r.push("access_unit_delimiter_rbsp");break;default:r.push("UNKNOWN NAL - "+e[t]&31)}return r},yn={avc1:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:Yt(e.subarray(78,e.byteLength))}},avcC:function(e){var t,n,i,r,a=new DataView(e.buffer,e.byteOffset,e.byteLength),s={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:3&e[4],sps:[],pps:[]},o=31&e[5];for(i=6,r=0;r<o;r++)n=a.getUint16(i),i+=2,s.sps.push(new Uint8Array(e.subarray(i,i+n))),i+=n;for(t=e[i],i++,r=0;r<t;r++)n=a.getUint16(i),i+=2,s.pps.push(new Uint8Array(e.subarray(i,i+n))),i+=n;return s},btrt:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},edts:function(e){return{boxes:Yt(e)}},elst:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:n.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),edits:[]},r=n.getUint32(4);for(t=8;r;r--)0===i.version?(i.edits.push({segmentDuration:n.getUint32(t),mediaTime:n.getInt32(t+4),mediaRate:n.getUint16(t+8)+n.getUint16(t+10)/65536}),t+=12):(i.edits.push({segmentDuration:fn(e.subarray(t)),mediaTime:fn(e.subarray(t+8)),mediaRate:n.getUint16(t+16)+n.getUint16(t+18)/65536}),t+=20);return i},esds:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),esId:e[6]<<8|e[7],streamPriority:31&e[8],decoderConfig:{objectProfileIndication:e[11],streamType:e[12]>>>2&63,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:e[26]>>>3&31,samplingFrequencyIndex:(7&e[26])<<1|e[27]>>>7&1,channelConfiguration:e[27]>>>3&15}}}},ftyp:function(e){for(var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n={majorBrand:gn(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},i=8;i<e.byteLength;)n.compatibleBrands.push(gn(e.subarray(i,i+4))),i+=4;return n},dinf:function(e){return{boxes:Yt(e)}},dref:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),dataReferences:Yt(e.subarray(8))}},hdlr:function(e){var t={version:new DataView(e.buffer,e.byteOffset,e.byteLength).getUint8(0),flags:new Uint8Array(e.subarray(1,4)),handlerType:gn(e.subarray(8,12)),name:""},n=8;for(n=24;n<e.byteLength;n++){if(0===e[n]){n++;break}t.name+=String.fromCharCode(e[n])}return t.name=decodeURIComponent(escape(t.name)),t},mdat:function(e){return{byteLength:e.byteLength,nals:vn(e)}},mdhd:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=4,r={version:n.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),language:""};return 1===r.version?(i+=4,r.creationTime=mn(n.getUint32(i)),i+=8,r.modificationTime=mn(n.getUint32(i)),i+=4,r.timescale=n.getUint32(i),i+=8,r.duration=n.getUint32(i)):(r.creationTime=mn(n.getUint32(i)),i+=4,r.modificationTime=mn(n.getUint32(i)),i+=4,r.timescale=n.getUint32(i),i+=4,r.duration=n.getUint32(i)),i+=4,t=n.getUint16(i),r.language+=String.fromCharCode(96+(t>>10)),r.language+=String.fromCharCode(96+((992&t)>>5)),r.language+=String.fromCharCode(96+(31&t)),r},mdia:function(e){return{boxes:Yt(e)}},mfhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sequenceNumber:e[4]<<24|e[5]<<16|e[6]<<8|e[7]}},minf:function(e){return{boxes:Yt(e)}},mp4a:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return e.byteLength>28&&(n.streamDescriptor=Yt(e.subarray(28))[0]),n},moof:function(e){return{boxes:Yt(e)}},moov:function(e){return{boxes:Yt(e)}},mvex:function(e){return{boxes:Yt(e)}},mvhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=4,i={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===i.version?(n+=4,i.creationTime=mn(t.getUint32(n)),n+=8,i.modificationTime=mn(t.getUint32(n)),n+=4,i.timescale=t.getUint32(n),n+=8,i.duration=t.getUint32(n)):(i.creationTime=mn(t.getUint32(n)),n+=4,i.modificationTime=mn(t.getUint32(n)),n+=4,i.timescale=t.getUint32(n),n+=4,i.duration=t.getUint32(n)),n+=4,i.rate=t.getUint16(n)+t.getUint16(n+2)/16,n+=4,i.volume=t.getUint8(n)+t.getUint8(n+1)/8,n+=2,n+=2,n+=8,i.matrix=new Uint32Array(e.subarray(n,n+36)),n+=36,n+=24,i.nextTrackId=t.getUint32(n),i},pdin:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(e){var t,n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t<e.byteLength;t++)n.samples.push({dependsOn:(48&e[t])>>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return n},sidx:dn,smhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),balance:e[4]+e[5]/256}},stbl:function(e){return{boxes:Yt(e)}},ctts:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:n.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),compositionOffsets:[]},r=n.getUint32(4);for(t=8;r;t+=8,r--)i.compositionOffsets.push({sampleCount:n.getUint32(t),sampleOffset:n[0===i.version?"getUint32":"getInt32"](t+4)});return i},stss:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:n.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),syncSamples:[]},r=n.getUint32(4);for(t=8;r;t+=4,r--)i.syncSamples.push(n.getUint32(t));return i},stco:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),chunkOffsets:[]},r=n.getUint32(4);for(t=8;r;t+=4,r--)i.chunkOffsets.push(n.getUint32(t));return i},stsc:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i=n.getUint32(4),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;i;t+=12,i--)r.sampleToChunks.push({firstChunk:n.getUint32(t),samplesPerChunk:n.getUint32(t+4),sampleDescriptionIndex:n.getUint32(t+8)});return r},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleDescriptions:Yt(e.subarray(8))}},stsz:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:n.getUint32(4),entries:[]};for(t=12;t<e.byteLength;t+=4)i.entries.push(n.getUint32(t));return i},stts:function(e){var t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),timeToSamples:[]},r=n.getUint32(4);for(t=8;r;t+=8,r--)i.timeToSamples.push({sampleCount:n.getUint32(t),sampleDelta:n.getUint32(t+4)});return i},styp:function(e){return yn.ftyp(e)},tfdt:un,tfhd:ln,tkhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=4,i={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4))};return 1===i.version?(n+=4,i.creationTime=mn(t.getUint32(n)),n+=8,i.modificationTime=mn(t.getUint32(n)),n+=4,i.trackId=t.getUint32(n),n+=4,n+=8,i.duration=t.getUint32(n)):(i.creationTime=mn(t.getUint32(n)),n+=4,i.modificationTime=mn(t.getUint32(n)),n+=4,i.trackId=t.getUint32(n),n+=4,n+=4,i.duration=t.getUint32(n)),n+=4,n+=8,i.layer=t.getUint16(n),n+=2,i.alternateGroup=t.getUint16(n),n+=2,i.volume=t.getUint8(n)+t.getUint8(n+1)/8,n+=2,n+=2,i.matrix=new Uint32Array(e.subarray(n,n+36)),n+=36,i.width=t.getUint16(n)+t.getUint16(n+2)/65536,n+=4,i.height=t.getUint16(n)+t.getUint16(n+2)/65536,i},traf:function(e){return{boxes:Yt(e)}},trak:function(e){return{boxes:Yt(e)}},trex:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:3&e[20],sampleIsDependedOn:(192&e[21])>>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:pn,"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}};Yt=function(e){for(var t,n,i,r,a,s=0,o=[],u=new ArrayBuffer(e.length),l=new Uint8Array(u),c=0;c<e.length;++c)l[c]=e[c];for(t=new DataView(u);s<e.byteLength;)n=t.getUint32(s),i=gn(e.subarray(s+4,s+8)),r=n>1?s+n:e.byteLength,(a=(yn[i]||function(e){return{data:e}})(e.subarray(s+8,r))).size=n,a.type=i,o.push(a),s=r;return o};var _n,bn,Tn,kn,Sn,wn,En,Cn,An={inspect:Yt,textify:Qt=function(e,t){var n;return t=t||0,n=new Array(2*t+1).join(" "),e.map(function(e,i){return n+e.type+"\n"+Object.keys(e).filter(function(e){return"type"!==e&&"boxes"!==e}).map(function(t){var i=n+" "+t+": ",r=e[t];if(r instanceof Uint8Array||r instanceof Uint32Array){var a=Array.prototype.slice.call(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map(function(e){return" "+("00"+e.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return a?1===a.length?i+"<"+a.join("").slice(1)+">":i+"<\n"+a.map(function(e){return n+" "+e}).join("\n")+"\n"+n+" >":i+"<>"}return i+JSON.stringify(r,null,2).split("\n").map(function(e,t){return 0===t?e:n+" "+e}).join("\n")}).join("\n")+(e.boxes?"\n"+Qt(e.boxes,t+1):"")}).join("\n")},parseType:gn,findBox:an,parseTraf:yn.traf,parseTfdt:yn.tfdt,parseHdlr:yn.hdlr,parseTfhd:yn.tfhd,parseTrun:yn.trun,parseSidx:yn.sidx},In=function(e){for(var t=0,n=String.fromCharCode(e[t]),i="";"\0"!==n;)i+=n,t++,n=String.fromCharCode(e[t]);return i+=n},xn=K.getUint64,Ln=function(e,t){var n="\0"!==t.scheme_id_uri,i=0===e&&Dn(t.presentation_time_delta)&&n,r=1===e&&Dn(t.presentation_time)&&n;return!(e>1)&&i||r},Dn=function(e){return void 0!==e||null!==e},Pn={parseEmsgBox:function(e){var t,n,i,r,a,s,o,u=4,l=e[0];if(0===l)u+=(t=In(e.subarray(u))).length,u+=(n=In(e.subarray(u))).length,i=(c=new DataView(e.buffer)).getUint32(u),u+=4,a=c.getUint32(u),u+=4,s=c.getUint32(u),u+=4,o=c.getUint32(u),u+=4;else if(1===l){var c;i=(c=new DataView(e.buffer)).getUint32(u),u+=4,r=xn(e.subarray(u)),u+=8,s=c.getUint32(u),u+=4,o=c.getUint32(u),u+=4,u+=(t=In(e.subarray(u))).length,u+=(n=In(e.subarray(u))).length}var d={scheme_id_uri:t,value:n,timescale:i||1,presentation_time:r,presentation_time_delta:a,event_duration:s,id:o,message_data:new Uint8Array(e.subarray(u,e.byteLength))};return Ln(l,d)?d:void 0},scaleTime:function(e,t,n,i){return e||0===e?e/t:i+n/t}},Rn=(_n="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},Jt),On=Zt,Nn=an,Un=en,Mn=Pn,Bn=ln,jn=pn,Fn=un,qn=K.getUint64,Vn=_n,Hn=Ge.parseId3Frames;bn=function(e){return Nn(e,["moov","trak"]).reduce(function(e,t){var n,i,r,a,s;return(n=Nn(t,["tkhd"])[0])?(i=n[0],a=Rn(n[r=0===i?12:20]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3]),(s=Nn(t,["mdia","mdhd"])[0])?(r=0===(i=s[0])?12:20,e[a]=Rn(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3]),e):null):null},{})},Tn=function(e,t){var n=Nn(t,["moof","traf"]).reduce(function(t,n){var i,r,a=Nn(n,["tfhd"])[0],s=Rn(a[4]<<24|a[5]<<16|a[6]<<8|a[7]),o=e[s]||9e4,u=Nn(n,["tfdt"])[0],l=new DataView(u.buffer,u.byteOffset,u.byteLength);return"bigint"==typeof(i=1===u[0]?qn(u.subarray(4,12)):l.getUint32(4))?r=i/Vn.BigInt(o):"number"!=typeof i||isNaN(i)||(r=i/o),r<Number.MAX_SAFE_INTEGER&&(r=Number(r)),r<t&&(t=r),t},1/0);return"bigint"==typeof n||isFinite(n)?n:0},kn=function(e,t){var n,i=Nn(t,["moof","traf"]),r=0,a=0;if(i&&i.length){var s=Nn(i[0],["tfhd"])[0],o=Nn(i[0],["trun"])[0],u=Nn(i[0],["tfdt"])[0];if(s)n=Bn(s).trackId;if(u)r=Fn(u).baseMediaDecodeTime;if(o){var l=jn(o);l.samples&&l.samples.length&&(a=l.samples[0].compositionTimeOffset||0)}}var c=e[n]||9e4;"bigint"==typeof r&&(a=Vn.BigInt(a),c=Vn.BigInt(c));var d=(r+a)/c;return"bigint"==typeof d&&d<Number.MAX_SAFE_INTEGER&&(d=Number(d)),d},Sn=function(e){var t=Nn(e,["moov","trak"]),n=[];return t.forEach(function(e){var t=Nn(e,["mdia","hdlr"]),i=Nn(e,["tkhd"]);t.forEach(function(e,t){var r,a,s=Un(e.subarray(8,12)),o=i[t];"vide"===s&&(a=0===(r=new DataView(o.buffer,o.byteOffset,o.byteLength)).getUint8(0)?r.getUint32(12):r.getUint32(20),n.push(a))})}),n},wn=function(e){var t=Nn(e,["moov","trak"]),n=[];return t.forEach(function(e){var t,i,r={},a=Nn(e,["tkhd"])[0];a&&(i=(t=new DataView(a.buffer,a.byteOffset,a.byteLength)).getUint8(0),r.id=0===i?t.getUint32(12):t.getUint32(20));var s=Nn(e,["mdia","hdlr"])[0];if(s){var o=Un(s.subarray(8,12));r.type="vide"===o?"video":"soun"===o?"audio":o}var u=Nn(e,["mdia","minf","stbl","stsd"])[0];if(u){var l=u.subarray(8);r.codec=Un(l.subarray(4,8));var c,d=Nn(l,[r.codec])[0];d&&(/^[asm]vc[1-9]$/i.test(r.codec)?(c=d.subarray(78),"avcC"===Un(c.subarray(4,8))&&c.length>11?(r.codec+=".",r.codec+=On(c[9]),r.codec+=On(c[10]),r.codec+=On(c[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(c=d.subarray(28),"esds"===Un(c.subarray(4,8))&&c.length>20&&0!==c[19]?(r.codec+="."+On(c[19]),r.codec+="."+On(c[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var h=Nn(e,["mdia","mdhd"])[0];h&&(r.timescale=En(h)),n.push(r)}),n},Cn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Nn(e,["emsg"]).map(function(e){var n=Mn.parseEmsgBox(new Uint8Array(e)),i=Hn(n.message_data);return{cueTime:Mn.scaleTime(n.presentation_time,n.timescale,n.presentation_time_delta,t),duration:Mn.scaleTime(n.event_duration,n.timescale),frames:i}})};var zn={findBox:Nn,parseType:Un,timescale:bn,startTime:Tn,compositionStartTime:kn,videoTrackIds:Sn,tracks:wn,getTimescaleFromMediaHeader:En=function(e){var t=0===e[0]?12:20;return Rn(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},getEmsgID3:Cn},Wn=An.parseTrun,Gn=zn.findBox,Xn=_n,Kn=function(e){var t=Gn(e,["moof","traf"]),n=Gn(e,["mdat"]),i=[];return n.forEach(function(e,n){var r=t[n];i.push({mdat:e,traf:r})}),i},Yn=function(e,t,n){var i=t,r=n.defaultSampleDuration||0,a=n.defaultSampleSize||0,s=n.trackId,o=[];return e.forEach(function(e){var t=Wn(e).samples;t.forEach(function(e){void 0===e.duration&&(e.duration=r),void 0===e.size&&(e.size=a),e.trackId=s,e.dts=i,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof i?(e.pts=i+Xn.BigInt(e.compositionTimeOffset),i+=Xn.BigInt(e.duration)):(e.pts=i+e.compositionTimeOffset,i+=e.duration)}),o=o.concat(t)}),o},Qn=ve.discardEmulationPreventionBytes,$n=De.CaptionStream,Jn=an,Zn=un,ei=ln,ti=Kn,ni=Yn,ii=function(e,t){for(var n=e,i=0;i<t.length;i++){var r=t[i];if(n<r.size)return r;n-=r.size}return null},ri=function(e,t){var n={};return ti(e).forEach(function(e){var i,r=e.mdat,a=e.traf,s=Jn(a,["tfhd"]),o=ei(s[0]),u=o.trackId,l=Jn(a,["tfdt"]),c=l.length>0?Zn(l[0]).baseMediaDecodeTime:0,d=Jn(a,["trun"]);t===u&&d.length>0&&(i=function(e,t,n){var i,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u={logs:[],seiNals:[]};for(r=0;r+4<e.length;r+=a)if(a=o.getUint32(r),r+=4,!(a<=0))switch(31&e[r]){case 6:var l=e.subarray(r+1,r+1+a),c=ii(r,t);if(i={nalUnitType:"sei_rbsp",size:a,data:l,escapedRBSP:Qn(l),trackId:n},c)i.pts=c.pts,i.dts=c.dts,s=c;else{if(!s){u.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+r+" for trackId "+n+". See mux.js#223."});break}i.pts=s.pts,i.dts=s.dts}u.seiNals.push(i)}return u}(r,ni(d,c,o),u),n[u]||(n[u]={seiNals:[],logs:[]}),n[u].seiNals=n[u].seiNals.concat(i.seiNals),n[u].logs=n[u].logs.concat(i.logs))}),n},ai=function(){var e,t,n,i,r,a,s=!1;this.isInitialized=function(){return s},this.init=function(t){e=new $n,s=!0,a=!!t&&t.isPartial,e.on("data",function(e){e.startTime=e.startPts/i,e.endTime=e.endPts/i,r.captions.push(e),r.captionStreams[e.stream]=!0}),e.on("log",function(e){r.logs.push(e)})},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"===k(t)&&0===Object.keys(t).length)&&(n!==e[0]||i!==t[n])},this.parse=function(e,a,s){var o;if(!this.isInitialized())return null;if(!a||!s)return null;if(this.isNewInit(a,s))n=a[0],i=s[n];else if(null===n||!i)return t.push(e),null;for(;t.length>0;){var u=t.shift();this.parse(u,a,s)}return o=function(e,t,n){if(null===t)return null;var i=ri(e,t)[t]||{};return{seiNals:i.seiNals,logs:i.logs,timescale:n}}(e,n,i),o&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach(function(t){e.push(t)})},this.flushStream=function(){if(!this.isInitialized())return null;a?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],n=null,i=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},si=An.parseTfdt,oi=an,ui=zn.getTimescaleFromMediaHeader,li=Yn,ci=Kn,di=function(){var e=9e4;this.init=function(t){var n=oi(t,["moov","trak","mdia","mdhd"])[0];n&&(e=ui(n))},this.parseSegment=function(t){var n=[],i=ci(t),r=0;return i.forEach(function(t){var i=t.mdat,a=t.traf,s=oi(a,["tfdt"])[0],o=oi(a,["tfhd"])[0],u=oi(a,["trun"]);if(s){var l=si(s);r=l.baseMediaDecodeTime}if(u.length&&o){var c=li(u,r,o),d=0;c.forEach(function(t){var r=new TextDecoder("utf-8"),a=i.slice(d,d+t.size);oi(a,["vtte"])[0]?d+=t.size:(oi(a,["vttc"]).forEach(function(i){var a,s,o=oi(i,["payl"])[0],u=oi(i,["sttg"])[0],l=t.pts/e,c=(t.pts+t.duration)/e;if(o)try{a=r.decode(o)}catch(vy){console.error(vy)}if(u)try{s=r.decode(u)}catch(vy){console.error(vy)}t.duration&&a&&n.push({cueText:a,start:l,end:c,settings:s})}),d+=t.size)})}}),n}},hi=Pe,pi=function(e){var t=31&e[1];return t<<=8,t|=e[2]},fi=function(e){return!!(64&e[1])},mi=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},gi=function(e){switch(e){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}},vi={parseType:function(e,t){var n=pi(e);return 0===n?"pat":n===t?"pmt":t?"pes":null},parsePat:function(e){var t=fi(e),n=4+mi(e);return t&&(n+=e[n]+1),(31&e[n+10])<<8|e[n+11]},parsePmt:function(e){var t={},n=fi(e),i=4+mi(e);if(n&&(i+=e[i]+1),1&e[i+5]){var r;r=3+((15&e[i+1])<<8|e[i+2])-4;for(var a=12+((15&e[i+10])<<8|e[i+11]);a<r;){var s=i+a;t[(31&e[s+1])<<8|e[s+2]]=e[s],a+=5+((15&e[s+3])<<8|e[s+4])}return t}},parsePayloadUnitStartIndicator:fi,parsePesType:function(e,t){switch(t[pi(e)]){case hi.H264_STREAM_TYPE:return"video";case hi.ADTS_STREAM_TYPE:return"audio";case hi.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!fi(e))return null;var t=4+mi(e);if(t>=e.byteLength)return null;var n,i=null;return 192&(n=e[t+7])&&((i={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,i.pts*=4,i.pts+=(6&e[t+13])>>>1,i.dts=i.pts,64&n&&(i.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,i.dts*=4,i.dts+=(6&e[t+18])>>>1)),i},videoPacketContainsKeyFrame:function(e){for(var t=4+mi(e),n=e.subarray(t),i=0,r=0,a=!1;r<n.byteLength-3;r++)if(1===n[r+2]){i=r+5;break}for(;i<n.byteLength;)switch(n[i]){case 0:if(0!==n[i-1]){i+=2;break}if(0!==n[i-2]){i++;break}r+3!==i-2&&"slice_layer_without_partitioning_rbsp_idr"===gi(31&n[r+3])&&(a=!0);do{i++}while(1!==n[i]&&i<n.length);r=i-2,i+=3;break;case 1:if(0!==n[i-1]||0!==n[i-2]){i+=3;break}"slice_layer_without_partitioning_rbsp_idr"===gi(31&n[r+3])&&(a=!0),r=i-2,i+=3;break;default:i+=3}return n=n.subarray(r),i-=r,r=0,n&&n.byteLength>3&&"slice_layer_without_partitioning_rbsp_idr"===gi(31&n[r+3])&&(a=!0),a}},yi=Pe,_i=Be.handleRollover,bi={};bi.ts=vi,bi.aac=Et;var Ti=de.ONE_SECOND_IN_TS,ki=188,Si=71,wi=function(e,t,n){for(var i,r,a,s,o=0,u=ki,l=!1;u<=e.byteLength;)if(e[o]!==Si||e[u]!==Si&&u!==e.byteLength)o++,u++;else{if(i=e.subarray(o,u),"pes"===bi.ts.parseType(i,t.pid))r=bi.ts.parsePesType(i,t.table),a=bi.ts.parsePayloadUnitStartIndicator(i),"audio"===r&&a&&(s=bi.ts.parsePesTime(i))&&(s.type="audio",n.audio.push(s),l=!0);if(l)break;o+=ki,u+=ki}for(o=(u=e.byteLength)-ki,l=!1;o>=0;)if(e[o]!==Si||e[u]!==Si&&u!==e.byteLength)o--,u--;else{if(i=e.subarray(o,u),"pes"===bi.ts.parseType(i,t.pid))r=bi.ts.parsePesType(i,t.table),a=bi.ts.parsePayloadUnitStartIndicator(i),"audio"===r&&a&&(s=bi.ts.parsePesTime(i))&&(s.type="audio",n.audio.push(s),l=!0);if(l)break;o-=ki,u-=ki}},Ei=function(e,t,n){for(var i,r,a,s,o,u,l,c=0,d=ki,h=!1,p={data:[],size:0};d<e.byteLength;)if(e[c]!==Si||e[d]!==Si)c++,d++;else{if(i=e.subarray(c,d),"pes"===bi.ts.parseType(i,t.pid))if(r=bi.ts.parsePesType(i,t.table),a=bi.ts.parsePayloadUnitStartIndicator(i),"video"===r&&(a&&!h&&(s=bi.ts.parsePesTime(i))&&(s.type="video",n.video.push(s),h=!0),!n.firstKeyFrame)){if(a&&0!==p.size){for(o=new Uint8Array(p.size),u=0;p.data.length;)l=p.data.shift(),o.set(l,u),u+=l.byteLength;if(bi.ts.videoPacketContainsKeyFrame(o)){var f=bi.ts.parsePesTime(o);f?(n.firstKeyFrame=f,n.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.")}p.size=0}p.data.push(i),p.size+=i.byteLength}if(h&&n.firstKeyFrame)break;c+=ki,d+=ki}for(c=(d=e.byteLength)-ki,h=!1;c>=0;)if(e[c]!==Si||e[d]!==Si)c--,d--;else{if(i=e.subarray(c,d),"pes"===bi.ts.parseType(i,t.pid))r=bi.ts.parsePesType(i,t.table),a=bi.ts.parsePayloadUnitStartIndicator(i),"video"===r&&a&&(s=bi.ts.parsePesTime(i))&&(s.type="video",n.video.push(s),h=!0);if(h)break;c-=ki,d-=ki}},Ci=function(e){var t={pid:null,table:null},n={};for(var i in function(e,t){for(var n,i=0,r=ki;r<e.byteLength;)if(e[i]!==Si||e[r]!==Si)i++,r++;else{switch(n=e.subarray(i,r),bi.ts.parseType(n,t.pid)){case"pat":t.pid=bi.ts.parsePat(n);break;case"pmt":var a=bi.ts.parsePmt(n);t.table=t.table||{},Object.keys(a).forEach(function(e){t.table[e]=a[e]})}i+=ki,r+=ki}}(e,t),t.table){if(t.table.hasOwnProperty(i))switch(t.table[i]){case yi.H264_STREAM_TYPE:n.video=[],Ei(e,t,n),0===n.video.length&&delete n.video;break;case yi.ADTS_STREAM_TYPE:n.audio=[],wi(e,t,n),0===n.audio.length&&delete n.audio}}return n},Ai=function(e,t){var n;return n=bi.aac.isLikelyAacData(e)?function(e){for(var t,n=!1,i=0,r=null,a=null,s=0,o=0;e.length-o>=3;){switch(bi.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){n=!0;break}if((s=bi.aac.parseId3TagSize(e,o))>e.length){n=!0;break}null===a&&(t=e.subarray(o,o+s),a=bi.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){n=!0;break}if((s=bi.aac.parseAdtsSize(e,o))>e.length){n=!0;break}null===r&&(t=e.subarray(o,o+s),r=bi.aac.parseSampleRate(t)),i++,o+=s;break;default:o++}if(n)return null}if(null===r||null===a)return null;var u=Ti/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*i*u,pts:a+1024*i*u}]}}(e):Ci(e),n&&(n.audio||n.video)?(function(e,t){if(e.audio&&e.audio.length){var n=t;(void 0===n||isNaN(n))&&(n=e.audio[0].dts),e.audio.forEach(function(e){e.dts=_i(e.dts,n),e.pts=_i(e.pts,n),e.dtsTime=e.dts/Ti,e.ptsTime=e.pts/Ti})}if(e.video&&e.video.length){var i=t;if((void 0===i||isNaN(i))&&(i=e.video[0].dts),e.video.forEach(function(e){e.dts=_i(e.dts,i),e.pts=_i(e.pts,i),e.dtsTime=e.dts/Ti,e.ptsTime=e.pts/Ti}),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=_i(r.dts,i),r.pts=_i(r.pts,i),r.dtsTime=r.dts/Ti,r.ptsTime=r.pts/Ti}}}(n,t),n):null},Ii=function(){return y(function e(t,n){g(this,e),this.options=n||{},this.self=t,this.init()},[{key:"init",value:function(){var e,t;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new $t.Transmuxer(this.options),e=this.self,(t=this.transmuxer).on("data",function(t){var n=t.initSegment;t.initSegment={data:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength};var i=t.data;t.data=i.buffer,e.postMessage({action:"data",segment:t,byteOffset:i.byteOffset,byteLength:i.byteLength},[t.data])}),t.on("done",function(t){e.postMessage({action:"done"})}),t.on("gopInfo",function(t){e.postMessage({action:"gopInfo",gopInfo:t})}),t.on("videoSegmentTimingInfo",function(t){var n={start:{decode:de.videoTsToSeconds(t.start.dts),presentation:de.videoTsToSeconds(t.start.pts)},end:{decode:de.videoTsToSeconds(t.end.dts),presentation:de.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:de.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(n.prependedContentDuration=de.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:n})}),t.on("audioSegmentTimingInfo",function(t){var n={start:{decode:de.videoTsToSeconds(t.start.dts),presentation:de.videoTsToSeconds(t.start.pts)},end:{decode:de.videoTsToSeconds(t.end.dts),presentation:de.videoTsToSeconds(t.end.pts)},baseMediaDecodeTime:de.videoTsToSeconds(t.baseMediaDecodeTime)};t.prependedContentDuration&&(n.prependedContentDuration=de.videoTsToSeconds(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:n})}),t.on("id3Frame",function(t){e.postMessage({action:"id3Frame",id3Frame:t})}),t.on("caption",function(t){e.postMessage({action:"caption",caption:t})}),t.on("trackinfo",function(t){e.postMessage({action:"trackinfo",trackInfo:t})}),t.on("audioTimingInfo",function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:de.videoTsToSeconds(t.start),end:de.videoTsToSeconds(t.end)}})}),t.on("videoTimingInfo",function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:de.videoTsToSeconds(t.start),end:de.videoTsToSeconds(t.end)}})}),t.on("log",function(t){e.postMessage({action:"log",log:t})})}},{key:"pushMp4Captions",value:function(e){this.captionParser||(this.captionParser=new ai,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),n=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:n&&n.captions||[],logs:n&&n.logs||[],data:t.buffer},[t.buffer])}},{key:"initMp4WebVttParser",value:function(e){this.webVttParser||(this.webVttParser=new di);var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.webVttParser.init(t)}},{key:"getMp4WebVttText",value:function(e){this.webVttParser||(this.webVttParser=new di);var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),n=this.webVttParser.parseSegment(t);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:n||[],data:t.buffer},[t.buffer])}},{key:"probeMp4StartTime",value:function(e){var t=e.timescales,n=e.data,i=zn.startTime(t,n);this.self.postMessage({action:"probeMp4StartTime",startTime:i,data:n},[n.buffer])}},{key:"probeMp4Tracks",value:function(e){var t=e.data,n=zn.tracks(t);this.self.postMessage({action:"probeMp4Tracks",tracks:n,data:t},[t.buffer])}},{key:"probeEmsgID3",value:function(e){var t=e.data,n=e.offset,i=zn.getEmsgID3(t,n);this.self.postMessage({action:"probeEmsgID3",id3Frames:i,emsgData:t},[t.buffer])}},{key:"probeTs",value:function(e){var t=e.data,n=e.baseStartTime,i="number"!=typeof n||isNaN(n)?void 0:n*de.ONE_SECOND_IN_TS,r=Ai(t,i),a=null;r&&((a={hasVideo:r.video&&2===r.video.length||!1,hasAudio:r.audio&&2===r.audio.length||!1}).hasVideo&&(a.videoStart=r.video[0].ptsTime),a.hasAudio&&(a.audioStart=r.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:a,data:t},[t.buffer])}},{key:"clearAllMp4Captions",value:function(){this.captionParser&&this.captionParser.clearAllCaptions()}},{key:"clearParsedMp4Captions",value:function(){this.captionParser&&this.captionParser.clearParsedCaptions()}},{key:"push",value:function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)}},{key:"reset",value:function(){this.transmuxer.reset()}},{key:"setTimestampOffset",value:function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(de.secondsToVideoTs(t)))}},{key:"setAudioAppendStart",value:function(e){this.transmuxer.setAudioAppendStart(Math.ceil(de.secondsToVideoTs(e.appendStart)))}},{key:"setRemux",value:function(e){this.transmuxer.setRemux(e.remux)}},{key:"flush",value:function(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}},{key:"endTimeline",value:function(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}},{key:"alignGopsWith",value:function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())}}])}();self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new Ii(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new Ii(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})),Nm=Dm(Om),Um=function(e){var t=e.transmuxer,n=e.bytes,i=e.audioAppendStart,r=e.gopsToAlignWith,a=e.remux,s=e.onData,o=e.onTrackInfo,u=e.onAudioTimingInfo,l=e.onVideoTimingInfo,c=e.onVideoSegmentTimingInfo,d=e.onAudioSegmentTimingInfo,h=e.onId3,p=e.onCaptions,f=e.onDone,m=e.onEndedTimeline,g=e.onTransmuxerLog,v=e.isEndOfTimeline,y=e.segment,_=e.triggerSegmentEventFn,b={buffer:[]},T=v;if(t.onmessage=function(n){t.currentTransmux===e&&("data"===n.data.action&&function(e,t,n){var i=e.data.segment,r=i.type,a=i.initSegment,s=i.captions,o=i.captionStreams,u=i.metadata,l=i.videoFrameDtsTime,c=i.videoFramePtsTime;t.buffer.push({captions:s,captionStreams:o,metadata:u});var d=e.data.segment.boxes||{data:e.data.segment.data},h={type:r,data:new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};void 0!==l&&(h.videoFrameDtsTime=l),void 0!==c&&(h.videoFramePtsTime=c),n(h)}(n,b,s),"trackinfo"===n.data.action&&o(n.data.trackInfo),"gopInfo"===n.data.action&&function(e,t){t.gopInfo=e.data.gopInfo}(n,b),"audioTimingInfo"===n.data.action&&u(n.data.audioTimingInfo),"videoTimingInfo"===n.data.action&&l(n.data.videoTimingInfo),"videoSegmentTimingInfo"===n.data.action&&c(n.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===n.data.action&&d(n.data.audioSegmentTimingInfo),"id3Frame"===n.data.action&&h([n.data.id3Frame],n.data.id3Frame.dispatchType),"caption"===n.data.action&&p(n.data.caption),"endedtimeline"===n.data.action&&(T=!1,m()),"log"===n.data.action&&g(n.data.log),"transmuxed"===n.data.type&&(T||(t.onmessage=null,function(e){var t=e.transmuxedData,n=e.callback;t.buffer=[],n(t)}({transmuxedData:b,callback:f}),Mm(t))))},t.onerror=function(){var e={message:"Received an error message from the transmuxer worker",metadata:{errorType:rf.Error.StreamingFailedToTransmuxSegment,segmentInfo:Dg({segment:y})}};f(null,e)},i&&t.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),void 0!==a&&t.postMessage({action:"setRemux",remux:a}),n.byteLength){var k=n instanceof ArrayBuffer?n:n.buffer,S=n instanceof ArrayBuffer?0:n.byteOffset;_({type:"segmenttransmuxingstart",segment:y}),t.postMessage({action:"push",data:k,byteOffset:S,byteLength:n.byteLength},[k])}v&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},Mm=function(e){e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():Um(e.currentTransmux))},Bm=function(e,t){e.postMessage({action:t}),Mm(e)},jm=function(e,t){if(!t.currentTransmux)return t.currentTransmux=e,void Bm(t,e);t.transmuxQueue.push(Bm.bind(null,t,e))},Fm=function(e){if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void Um(e);e.transmuxer.transmuxQueue.push(e)},qm=function(e){jm("reset",e)},Vm=function(e){var t=new Nm;t.currentTransmux=null,t.transmuxQueue=[];var n=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,n.call(t)},t.postMessage({action:"init",options:e}),t},Hm=function(e){var t=e.transmuxer,n=e.endAction||e.action,i=e.callback,r=$({},e,{endAction:null,transmuxer:null,callback:null}),a=function(r){r.data.action===n&&(t.removeEventListener("message",a),r.data.data&&(r.data.data=new Uint8Array(r.data.data,e.byteOffset||0,e.byteLength||r.data.data.byteLength),e.data&&(e.data=r.data.data)),i(r.data))};if(t.addEventListener("message",a),e.data){var s=e.data instanceof ArrayBuffer;r.byteOffset=s?0:e.data.byteOffset,r.byteLength=e.data.byteLength;var o=[s?e.data:e.data.buffer];t.postMessage(r,o)}else t.postMessage(r)},zm=2,Wm=-101,Gm=-102,Xm="wvtt",Km=function(e){e.forEach(function(e){e.abort()})},Ym=function(e,t){var n=t.requestType,i=$f({requestType:n,request:t,error:e});return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Wm,xhr:t,metadata:i}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:Gm,xhr:t,metadata:i}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:zm,xhr:t,metadata:i}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:zm,xhr:t,metadata:i}:null},Qm=function(e,t,n,i){return function(r,a){var s=a.response,o=Ym(r,a);if(o)return n(o,e);if(16!==s.byteLength)return n({status:a.status,message:"Invalid HLS key at URL: "+a.uri,code:zm,xhr:a},e);for(var u=new DataView(s),l=new Uint32Array([u.getUint32(0),u.getUint32(4),u.getUint32(8),u.getUint32(12)]),c=0;c<t.length;c++)t[c].bytes=l;var d={uri:a.uri};return i({type:"segmentkeyloadcomplete",segment:e,keyInfo:d}),n(null,e)}},$m=function(e,t){var n=mu(e.map.bytes);if("mp4"!==n){var i=e.map.resolvedUri||e.map.uri,r=n||"unknown";return t({internal:!0,message:"Found unsupported ".concat(r," container for initialization segment at URL: ").concat(i),code:zm,metadata:{mediaType:r}})}Hm({action:"probeMp4Tracks",data:e.map.bytes,transmuxer:e.transmuxer,callback:function(n){var i=n.tracks,r=n.data;return e.map.bytes=r,i.forEach(function(t){e.map.tracks=e.map.tracks||{},e.map.tracks[t.type]||(e.map.tracks[t.type]=t,"number"==typeof t.id&&t.timescale&&(e.map.timescales=e.map.timescales||{},e.map.timescales[t.id]=t.timescale),"text"===t.type&&function(e,t){t===Xm&&e.transmuxer.postMessage({action:"initMp4WebVttParser",data:e.map.bytes})}(e,t.codec))}),t(null)}})},Jm=function(e){var t=e.segment,n=e.finishProcessingFn,i=e.responseType,r=e.triggerSegmentEventFn;return function(e,a){var s=Ym(e,a);if(s)return n(s,t);r({type:"segmentloaded",segment:t});var o="arraybuffer"!==i&&a.responseText?function(e){for(var t=new Uint8Array(new ArrayBuffer(e.length)),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t.buffer}(a.responseText.substring(t.lastReachedChar||0)):a.response;return t.stats=function(e){return{bandwidth:e.bandwidth,bytesReceived:e.bytesReceived||0,roundTripTime:e.roundTripTime||0}}(a),t.key?t.encryptedBytes=new Uint8Array(o):t.bytes=new Uint8Array(o),n(null,t)}},Zm=function(e){var t=e.segment,n=e.bytes,i=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=e.triggerSegmentEventFn,m=t.map&&t.map.tracks||{},g=Boolean(m.audio&&m.video),v=r.bind(null,t,"audio","start"),y=r.bind(null,t,"audio","end"),_=r.bind(null,t,"video","start"),b=r.bind(null,t,"video","end");Hm({action:"probeTs",transmuxer:t.transmuxer,data:n,baseStartTime:t.baseStartTime,callback:function(e){t.bytes=n=e.data;var r=e.result;r&&(i(t,{hasAudio:r.hasAudio,hasVideo:r.hasVideo,isMuxed:g}),i=null),Fm({bytes:n,transmuxer:t.transmuxer,audioAppendStart:t.audioAppendStart,gopsToAlignWith:t.gopsToAlignWith,remux:g,onData:function(e){e.type="combined"===e.type?"video":e.type,d(t,e)},onTrackInfo:function(e){i&&(g&&(e.isMuxed=!0),i(t,e))},onAudioTimingInfo:function(e){v&&void 0!==e.start&&(v(e.start),v=null),y&&void 0!==e.end&&y(e.end)},onVideoTimingInfo:function(e){_&&void 0!==e.start&&(_(e.start),_=null),b&&void 0!==e.end&&b(e.end)},onVideoSegmentTimingInfo:function(e){var n={pts:{start:e.start.presentation,end:e.end.presentation},dts:{start:e.start.decode,end:e.end.decode}};f({type:"segmenttransmuxingtiminginfoavailable",segment:t,timingInfo:n}),a(e)},onAudioSegmentTimingInfo:function(e){var n={pts:{start:e.start.pts,end:e.end.pts},dts:{start:e.start.dts,end:e.end.dts}};f({type:"segmenttransmuxingtiminginfoavailable",segment:t,timingInfo:n}),s(e)},onId3:function(e,n){o(t,e,n)},onCaptions:function(e){u(t,[e])},isEndOfTimeline:l,onEndedTimeline:function(){c()},onTransmuxerLog:p,onDone:function(e,n){h&&(e.type="combined"===e.type?"video":e.type,f({type:"segmenttransmuxingcomplete",segment:t}),h(n,t,e))},segment:t,triggerSegmentEventFn:f})}})},eg=function(e){var t=e.segment,n=e.bytes,i=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=e.triggerSegmentEventFn,m=new Uint8Array(n);if(function(e){return Yo(e,["moof"]).length>0}(m)){t.isFmp4=!0;var g=t.map.tracks;if(g.text&&(!g.audio||!g.video))return d(t,{data:m,type:"text"}),void function(e,t,n){t===Xm&&Hm({action:"getMp4WebVttText",data:e.bytes,transmuxer:e.transmuxer,callback:function(t){var i=t.data,r=t.mp4VttCues;e.bytes=i,n(null,e,{mp4VttCues:r})}})}(t,g.text.codec,h);var v={isFmp4:!0,hasVideo:!!g.video,hasAudio:!!g.audio};g.audio&&g.audio.codec&&"enca"!==g.audio.codec&&(v.audioCodec=g.audio.codec),g.video&&g.video.codec&&"encv"!==g.video.codec&&(v.videoCodec=g.video.codec),g.video&&g.audio&&(v.isMuxed=!0),i(t,v);var y=function(e,n){d(t,{data:m,type:v.hasAudio&&!v.isMuxed?"audio":"video"}),n&&n.length&&o(t,n),e&&e.length&&u(t,e),h(null,t,{})};Hm({action:"probeMp4StartTime",timescales:t.map.timescales,data:m,transmuxer:t.transmuxer,callback:function(e){var i=e.data,a=e.startTime;n=i.buffer,t.bytes=m=i,v.hasAudio&&!v.isMuxed&&r(t,"audio","start",a),v.hasVideo&&r(t,"video","start",a),Hm({action:"probeEmsgID3",data:m,transmuxer:t.transmuxer,offset:a,callback:function(e){var i=e.emsgData,r=e.id3Frames;n=i.buffer,t.bytes=m=i,g.video&&i.byteLength&&t.transmuxer?Hm({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:m,timescales:t.map.timescales,trackIds:[g.video.id],callback:function(e){n=e.data.buffer,t.bytes=m=e.data,e.logs.forEach(function(e){p(mf(e,{stream:"mp4CaptionParser"}))}),y(e.captions,r)}}):y(void 0,r)}})}})}else if(t.transmuxer){if(void 0===t.container&&(t.container=mu(m)),"ts"!==t.container&&"aac"!==t.container)return i(t,{hasAudio:!1,hasVideo:!1}),void h(null,t,{});Zm({segment:t,bytes:n,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p,triggerSegmentEventFn:f})}else h(null,t,{})},tg=function(e,t){var n,i=e.id,r=e.key,a=e.encryptedBytes,s=e.decryptionWorker,o=e.segment,u=e.doneFn,l=function(e){if(e.data.source===i){s.removeEventListener("message",l);var n=e.data.decrypted;t(new Uint8Array(n.bytes,n.byteOffset,n.byteLength))}};s.onerror=function(){var e="An error occurred in the decryption worker",t=Dg({segment:o}),n={message:e,metadata:{error:new Error(e),errorType:rf.Error.StreamingFailedToDecryptSegment,segmentInfo:t,keyInfo:{uri:o.key.resolvedUri||o.map.key.resolvedUri}}};u(n,o)},s.addEventListener("message",l),n=r.bytes.slice?r.bytes.slice():new Uint32Array(Array.prototype.slice.call(r.bytes)),s.postMessage(pm({source:i,encrypted:a,key:n,iv:r.iv}),[a.buffer,n.buffer])},ng=function(e){var t=e.activeXhrs,n=e.decryptionWorker,i=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=e.triggerSegmentEventFn,m=0,g=!1;return function(e,v){if(!g){if(e)return g=!0,Km(t),h(e,v);if((m+=1)===t.length){var y=function(){if(v.encryptedBytes)return function(e){var t=e.decryptionWorker,n=e.segment,i=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=e.triggerSegmentEventFn;f({type:"segmentdecryptionstart"}),tg({id:n.requestId,key:n.key,encryptedBytes:n.encryptedBytes,decryptionWorker:t,segment:n,doneFn:h},function(e){n.bytes=e,f({type:"segmentdecryptioncomplete",segment:n}),eg({segment:n,bytes:n.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p,triggerSegmentEventFn:f})})}({decryptionWorker:n,segment:v,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p,triggerSegmentEventFn:f});eg({segment:v,bytes:v.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p,triggerSegmentEventFn:f})};if(v.endOfAllRequests=Date.now(),v.map&&v.map.encryptedBytes&&!v.map.bytes)return f({type:"segmentdecryptionstart",segment:v}),tg({decryptionWorker:n,id:v.requestId+"-init",encryptedBytes:v.map.encryptedBytes,key:v.map.key,segment:v,doneFn:h},function(e){v.map.bytes=e,f({type:"segmentdecryptioncomplete",segment:v}),$m(v,function(e){if(e)return Km(t),h(e,v);y()})});y()}}}},ig=function(e){var t=e.segment,n=e.progressFn;e.trackInfoFn,e.timingInfoFn,e.videoSegmentTimingInfoFn,e.audioSegmentTimingInfoFn,e.id3Fn,e.captionsFn,e.isEndOfTimeline,e.endedTimelineFn,e.dataFn;return function(e){if(!e.target.aborted)return t.stats=mf(t.stats,function(e){var t=e.target,n={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return n.bytesReceived=e.loaded,n.bandwidth=Math.floor(n.bytesReceived/n.roundTripTime*8*1e3),n}(e)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),n(e,t)}},rg=function(e){var t=e.xhr,n=e.xhrOptions,i=e.decryptionWorker,r=e.segment,a=e.abortFn,s=e.progressFn,o=e.trackInfoFn,u=e.timingInfoFn,l=e.videoSegmentTimingInfoFn,c=e.audioSegmentTimingInfoFn,d=e.id3Fn,h=e.captionsFn,p=e.isEndOfTimeline,f=e.endedTimelineFn,m=e.dataFn,g=e.doneFn,v=e.onTransmuxerLog,y=e.triggerSegmentEventFn,_=[],b=ng({activeXhrs:_,decryptionWorker:i,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:d,captionsFn:h,isEndOfTimeline:p,endedTimelineFn:f,dataFn:m,doneFn:g,onTransmuxerLog:v,triggerSegmentEventFn:y});if(r.key&&!r.key.bytes){var T=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&T.push(r.map.key);var k=mf(n,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),S=Qm(r,T,b,y);y({type:"segmentkeyloadstart",segment:r,keyInfo:{uri:r.key.resolvedUri}});var w=t(k,S);_.push(w)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){var E=mf(n,{uri:r.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),C=Qm(r,[r.map.key],b,y);y({type:"segmentkeyloadstart",segment:r,keyInfo:{uri:r.map.key.resolvedUri}});var A=t(E,C);_.push(A)}var I=mf(n,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:lm(r.map),requestType:"segment-media-initialization"}),x=function(e){var t=e.segment,n=e.finishProcessingFn,i=e.triggerSegmentEventFn;return function(e,r){var a=Ym(e,r);if(a)return n(a,t);var s=new Uint8Array(r.response);if(i({type:"segmentloaded",segment:t}),t.map.key)return t.map.encryptedBytes=s,n(null,t);t.map.bytes=s,$m(t,function(e){if(e)return e.xhr=r,e.status=r.status,n(e,t);n(null,t)})}}({segment:r,finishProcessingFn:b,triggerSegmentEventFn:y});y({type:"segmentloadstart",segment:r});var L=t(I,x);_.push(L)}var D=mf(n,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:lm(r),requestType:"segment"}),P=Jm({segment:r,finishProcessingFn:b,responseType:D.responseType,triggerSegmentEventFn:y});y({type:"segmentloadstart",segment:r});var R=t(D,P);R.addEventListener("progress",ig({segment:r,progressFn:s,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:d,captionsFn:h,isEndOfTimeline:p,endedTimelineFn:f,dataFn:m})),_.push(R);var O={};return _.forEach(function(e){e.addEventListener("loadend",function(e){var t=e.loadendState,n=e.abortFn;return function(e){e.target.aborted&&n&&!t.calledAbortFn&&(n(),t.calledAbortFn=!0)}}({loadendState:O,abortFn:a}))}),function(){return Km(_)}},ag=ff("CodecUtils"),sg=function(e,t){var n=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&n.AUDIO&&e.mediaGroups.AUDIO[n.AUDIO]},og=function(e){var t={};return e.forEach(function(e){var n=e.mediaType,i=e.type,r=e.details;t[n]=t[n]||[],t[n].push(mr("".concat(i).concat(r)))}),Object.keys(t).forEach(function(e){if(t[e].length>1)return ag("multiple ".concat(e," codecs found as attributes: ").concat(t[e].join(", "),". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.")),void(t[e]=null);t[e]=t[e][0]}),t},ug=function(e){var t=0;return e.audio&&t++,e.video&&t++,t},lg=function(e,t){var n=t.attributes||{},i=og(function(e){var t=e.attributes||{};if(t.CODECS)return gr(t.CODECS)}(t)||[]);if(sg(e,t)&&!i.audio&&!function(e,t){if(!sg(e,t))return!0;var n=t.attributes||{},i=e.mediaGroups.AUDIO[n.AUDIO];for(var r in i)if(!i[r].uri&&!i[r].playlists)return!0;return!1}(e,t)){var r=og(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var n=e.mediaGroups.AUDIO[t];if(!n)return null;for(var i in n){var r=n[i];if(r.default&&r.playlists)return gr(r.playlists[0].attributes.CODECS)}return null}(e,n.AUDIO)||[]);r.audio&&(i.audio=r.audio)}return i},cg=ff("PlaylistSelector"),dg=function(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}},hg=function(e,t){if(!e)return"";var n=wn.getComputedStyle(e);return n?n[t]:""},pg=function(e,t){var n=e.slice();e.sort(function(e,i){var r=t(e,i);return 0===r?n.indexOf(e)-n.indexOf(i):r})},fg=function(e,t){var n,i;return e.attributes.BANDWIDTH&&(n=e.attributes.BANDWIDTH),n=n||wn.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(i=t.attributes.BANDWIDTH),n-(i=i||wn.Number.MAX_VALUE)},mg=function(e,t,n,i,r,a){if(e){var s={bandwidth:t,width:n,height:i,limitRenditionByPlayerDimensions:r},o=e.playlists;Hf.isAudioOnly(e)&&(o=a.getAudioTrackPlaylists_(),s.audioOnly=!0);var u=o.map(function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,n=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||wn.Number.MAX_VALUE,width:t,height:n,playlist:e}});pg(u,function(e,t){return e.bandwidth-t.bandwidth});var l=(u=u.filter(function(e){return!Hf.isIncompatible(e.playlist)})).filter(function(e){return Hf.isEnabled(e.playlist)});l.length||(l=u.filter(function(e){return!Hf.isDisabled(e.playlist)}));var c=l.filter(function(e){return e.bandwidth*xm.BANDWIDTH_VARIANCE<t}),d=c[c.length-1],h=c.filter(function(e){return e.bandwidth===d.bandwidth})[0];if(!1===r){var p=h||l[0]||u[0];if(p&&p.playlist){var f="sortedPlaylistReps";return h&&(f="bandwidthBestRep"),l[0]&&(f="enabledPlaylistReps"),cg("choosing ".concat(dg(p)," using ").concat(f," with options"),s),p.playlist}return cg("could not choose a playlist with options",s),null}var m=c.filter(function(e){return e.width&&e.height});pg(m,function(e,t){return e.width-t.width});var g=m.filter(function(e){return e.width===n&&e.height===i});d=g[g.length-1];var v,y,_,b,T=g.filter(function(e){return e.bandwidth===d.bandwidth})[0];if(T||(y=(v=m.filter(function(e){return e.width>n||e.height>i})).filter(function(e){return e.width===v[0].width&&e.height===v[0].height}),d=y[y.length-1],_=y.filter(function(e){return e.bandwidth===d.bandwidth})[0]),a.leastPixelDiffSelector){var k=m.map(function(e){return e.pixelDiff=Math.abs(e.width-n)+Math.abs(e.height-i),e});pg(k,function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff}),b=k[0]}var S=b||_||T||h||l[0]||u[0];if(S&&S.playlist){var w="sortedPlaylistReps";return b?w="leastPixelDiffRep":_?w="resolutionPlusOneRep":T?w="resolutionBestRep":h?w="bandwidthBestRep":l[0]&&(w="enabledPlaylistReps"),cg("choosing ".concat(dg(S)," using ").concat(w," with options"),s),S.playlist}return cg("could not choose a playlist with options",s),null}},gg=function(){var e=this.useDevicePixelRatio&&wn.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(e=this.customPixelRatio),mg(this.playlists.main,this.systemBandwidth,parseInt(hg(this.tech_.el(),"width"),10)*e,parseInt(hg(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.playlistController_)};function vg(e){try{return new URL(e).pathname.split("/").slice(-2).join("/")}catch(vy){return""}}var yg=function(e){var t=e.inbandTextTracks,n=e.metadataArray,i=e.timestampOffset,r=e.videoDuration;if(n){var a=wn.WebKitDataCue||wn.VTTCue,s=t.metadataTrack_;if(s&&(n.forEach(function(e){var t=e.cueTime+i;!("number"!=typeof t||wn.isNaN(t)||t<0)&&t<1/0&&e.frames&&e.frames.length&&e.frames.forEach(function(e){var n=new a(t,t,e.value||e.url||e.data||"");n.frame=e,n.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return rf.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return rf.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return rf.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(n),s.addCue(n)})}),s.cues&&s.cues.length)){for(var o=s.cues,u=[],l=0;l<o.length;l++)o[l]&&u.push(o[l]);var c=u.reduce(function(e,t){var n=e[t.startTime]||[];return n.push(t),e[t.startTime]=n,e},{}),d=Object.keys(c).sort(function(e,t){return Number(e)-Number(t)});d.forEach(function(e,t){var n=c[e],i=isFinite(r)?r:e,a=Number(d[t+1])||i;n.forEach(function(e){e.endTime=a})})}}},_g={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"},bg=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Tg=function(e,t,n){e.metadataTrack_||(e.metadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,rf.browser.IS_ANY_SAFARI||(e.metadataTrack_.inBandMetadataTrackDispatchType=t))},kg=function(e,t,n){var i,r;if(n&&n.cues)for(i=n.cues.length;i--;)(r=n.cues[i]).startTime>=e&&r.endTime<=t&&n.removeCue(r)},Sg=function(e){return"number"==typeof e&&isFinite(e)},wg=1/60,Eg=function(e){var t=e.startOfSegment,n=e.duration,i=e.segment,r=e.part,a=e.playlist,s=a.mediaSequence,o=a.id,u=a.segments,l=void 0===u?[]:u,c=e.mediaIndex,d=e.partIndex,h=e.timeline,p=l.length-1,f="mediaIndex/partIndex increment";e.getMediaInfoForTime?f="getMediaInfoForTime (".concat(e.getMediaInfoForTime,")"):e.isSyncRequest&&(f="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(f+=" with independent ".concat(e.independent));var m="number"==typeof d,g=e.segment.uri?"segment":"pre-segment",v=m?xf({preloadSegment:i})-1:0;return"".concat(g," [").concat(s+c,"/").concat(s+p,"]")+(m?" part [".concat(d,"/").concat(v,"]"):"")+" segment start/end [".concat(i.start," => ").concat(i.end,"]")+(m?" part start/end [".concat(r.start," => ").concat(r.end,"]"):"")+" startOfSegment [".concat(t,"]")+" duration [".concat(n,"]")+" timeline [".concat(h,"]")+" selected by [".concat(f,"]")+" playlist [".concat(o,"]")},Cg=function(e){return"".concat(e,"TimingInfo")},Ag=function(e){var t=e.timelineChangeController,n=e.currentTimeline,i=e.segmentTimeline,r=e.loaderType,a=e.audioDisabled;if(n===i)return!1;if("audio"===r){var s=t.lastTimelineChange({type:"main"});return!s||s.to!==i}if("main"===r&&a){var o=t.pendingTimelineChange({type:"audio"});return!o||o.to!==i}return!1},Ig=function(e){var t=e.pendingSegment_;if(t&&(Ag({timelineChangeController:e.timelineChangeController_,currentTimeline:e.currentTimeline_,segmentTimeline:t.timeline,loaderType:e.loaderType_,audioDisabled:e.audioDisabled_})&&function(e){if(!e)return!1;var t=e.pendingTimelineChange({type:"audio"}),n=e.pendingTimelineChange({type:"main"}),i=t&&n,r=i&&t.to!==n.to;return!(!i||-1===t.from||-1===n.from||!r)}(e.timelineChangeController_))){if(function(e){var t=e.timelineChangeController_.pendingTimelineChange({type:"audio"}),n=e.timelineChangeController_.pendingTimelineChange({type:"main"});return t&&n&&t.to<n.to}(e))return void e.timelineChangeController_.trigger("audioTimelineBehind");e.timelineChangeController_.trigger("fixBadTimelineChange")}},xg=function(e){var t=e.segmentDuration,n=e.maxDuration;return!!t&&Math.round(t)>n+vf},Lg=function(e,t){if("hls"!==t)return null;var n,i,r=(n={audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo},i=0,["video","audio"].forEach(function(e){var t=n["".concat(e,"TimingInfo")];if(t){var r,a=t.start,s=t.end;"bigint"==typeof a||"bigint"==typeof s?r=wn.BigInt(s)-wn.BigInt(a):"number"==typeof a&&"number"==typeof s&&(r=s-a),void 0!==r&&r>i&&(i=r)}}),"bigint"==typeof i&&i<Number.MAX_SAFE_INTEGER&&(i=Number(i)),i);if(!r)return null;var a=e.playlist.targetDuration,s=xg({segmentDuration:r,maxDuration:2*a}),o=xg({segmentDuration:r,maxDuration:a}),u="Segment with index ".concat(e.mediaIndex," ")+"from playlist ".concat(e.playlist.id," ")+"has a duration of ".concat(r," ")+"when the reported duration is ".concat(e.duration," ")+"and the target duration is ".concat(a,". ")+"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||o?{severity:s?"warn":"info",message:u}:null},Dg=function(e){var t=e.type,n=e.segment;if(n){var i=Boolean(n.key||n.map&&n.map.ke),r=Boolean(n.map&&!n.map.bytes),a=void 0===n.startOfSegment?n.start:n.startOfSegment;return{type:t||n.type,uri:n.resolvedUri||n.uri,start:a,duration:n.duration,isEncrypted:i,isMediaInitialization:r}}},Pg=function(){function e(t){var n;if(g(this,e),n=c(this,e),!t)throw new TypeError("Initialization settings are required");if("function"!=typeof t.currentTime)throw new TypeError("No currentTime getter specified");if(!t.mediaSource)throw new TypeError("No MediaSource specified");return n.bandwidth=t.bandwidth,n.throughput={rate:0,count:0},n.roundTrip=NaN,n.resetStats_(),n.mediaIndex=null,n.partIndex=null,n.hasPlayed_=t.hasPlayed,n.currentTime_=t.currentTime,n.seekable_=t.seekable,n.seeking_=t.seeking,n.duration_=t.duration,n.mediaSource_=t.mediaSource,n.vhs_=t.vhs,n.loaderType_=t.loaderType,n.currentMediaInfo_=void 0,n.startingMediaInfo_=void 0,n.segmentMetadataTrack_=t.segmentMetadataTrack,n.goalBufferLength_=t.goalBufferLength,n.sourceType_=t.sourceType,n.sourceUpdater_=t.sourceUpdater,n.inbandTextTracks_=t.inbandTextTracks,n.state_="INIT",n.timelineChangeController_=t.timelineChangeController,n.shouldSaveSegmentTimingInfo_=!0,n.parse708captions_=t.parse708captions,n.useDtsForTimestampOffset_=t.useDtsForTimestampOffset,n.captionServices_=t.captionServices,n.exactManifestTimings=t.exactManifestTimings,n.addMetadataToTextTrack=t.addMetadataToTextTrack,n.checkBufferTimeout_=null,n.error_=void 0,n.currentTimeline_=-1,n.shouldForceTimestampOffsetAfterResync_=!1,n.pendingSegment_=null,n.xhrOptions_=null,n.pendingSegments_=[],n.audioDisabled_=!1,n.isPendingTimestampOffset_=!1,n.gopBuffer_=[],n.timeMapping_=0,n.safeAppend_=!1,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=null,n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=t.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=t.decrypter,n.syncController_=t.syncController,n.syncPoint_={segmentIndex:0,time:0},n.transmuxer_=n.createTransmuxer_(),n.triggerSyncInfoUpdate_=function(){return n.trigger("syncinfoupdate")},n.syncController_.on("syncinfoupdate",n.triggerSyncInfoUpdate_),n.mediaSource_.addEventListener("sourceopen",function(){n.isEndOfStream_()||(n.ended_=!1)}),n.fetchAtBuffer_=!1,n.logger_=ff("SegmentLoader[".concat(n.loaderType_,"]")),Object.defineProperty(n,"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_("".concat(this.state_," -> ").concat(e)),this.state_=e,this.trigger("statechange"))}}),n.sourceUpdater_.on("ready",function(){n.hasEnoughInfoToAppend_()?n.processCallQueue_():Ig(n)}),n.sourceUpdater_.on("codecschange",function(e){n.trigger($({type:"codecschange"},e))}),"main"===n.loaderType_&&n.timelineChangeController_.on("pendingtimelinechange",function(){n.hasEnoughInfoToAppend_()?n.processCallQueue_():Ig(n)}),"audio"===n.loaderType_&&n.timelineChangeController_.on("timelinechange",function(e){n.trigger($({type:"timelinechange"},e)),n.hasEnoughInfoToLoad_()?n.processLoadQueue_():Ig(n),n.hasEnoughInfoToAppend_()?n.processCallQueue_():Ig(n)}),n}return f(e,rf.EventTarget),y(e,[{key:"mediaSequenceSync_",get:function(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}},{key:"createTransmuxer_",value:function(){return Vm({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}},{key:"resetStats_",value:function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}},{key:"dispose",value:function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&wn.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}},{key:"setAudio",value:function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}},{key:"abort",value:function(){if("WAITING"!==this.state)return this.pendingSegment_&&(this.pendingSegment_=null),void this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}},{key:"abort_",value:function(){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,wn.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}},{key:"checkForAbort_",value:function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)}},{key:"error",value:function(e){return void 0!==e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0,this.transmuxer_&&qm(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}},{key:"buffered_",value:function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return gf();if("main"===this.loaderType_){var t=e.hasAudio,n=e.hasVideo,i=e.isMuxed;if(n&&t&&!this.audioDisabled_&&!i)return this.sourceUpdater_.buffered();if(n)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}},{key:"initSegmentForMap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var n=fm(e),i=this.initSegments_[n];return t&&!i&&e.bytes&&(this.initSegments_[n]=i={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),i||e}},{key:"segmentKey",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var n=mm(e),i=this.keyCache_[n];this.cacheEncryptionKeys_&&t&&!i&&e.bytes&&(this.keyCache_[n]=i={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(i||e).resolvedUri};return i&&(r.bytes=i.bytes),r}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&!(this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)){var n=this.playlist_,i=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(n&&(n.id?r=n.id:n.uri&&(r=n.uri)),this.logger_("playlist update [".concat(r," => ").concat(e.id||e.uri,"]")),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_("Playlist update:\ncurrentTime: ".concat(this.currentTime_(),"\nbufferedEnd: ").concat(wf(this.buffered_()),"\n"),this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!n||n.uri!==e.uri){if(null!==this.mediaIndex)!e.endList&&"number"==typeof e.partTargetDuration?this.resetLoader():this.resyncLoader();return this.currentMediaInfo_=void 0,void this.trigger("playlistupdate")}var a=e.mediaSequence-n.mediaSequence;if(this.logger_("live window shift [".concat(a,"]")),null!==this.mediaIndex)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var s=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!s.parts||!s.parts.length||!s.parts[this.partIndex])){var o=this.mediaIndex;this.logger_("currently processing part (index ".concat(this.partIndex,") no longer exists.")),this.resetLoader(),this.mediaIndex=o}}i&&(i.mediaIndex-=a,i.mediaIndex<0?(i.mediaIndex=null,i.partIndex=null):(i.mediaIndex>=0&&(i.segment=e.segments[i.mediaIndex]),i.partIndex>=0&&i.segment.parts&&(i.part=i.segment.parts[i.partIndex]))),this.syncController_.saveExpiredSegmentInfo(n,e)}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(wn.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return null===this.checkBufferTimeout_}},{key:"resetEverything",value:function(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"}))}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}},{key:"resyncLoader",value:function(){this.transmuxer_&&qm(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;var e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;"hls"===this.sourceType_&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}},{key:"remove",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t===1/0&&(t=this.duration_()),t<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var r=1,a=function(){0===--r&&n()};for(var s in!i&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,a)),(i||"main"===this.loaderType_)&&(this.gopBuffer_=function(e,t,n,i){for(var r=Math.ceil((t-i)*yu),a=Math.ceil((n-i)*yu),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var u=o+1;u--&&!(e[u].pts<=r););return u=Math.max(u,0),s.splice(u,o-u+1),s}(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a)),this.inbandTextTracks_)kg(e,t,this.inbandTextTracks_[s]);kg(e,t,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&wn.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=wn.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&wn.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=wn.setTimeout(this.monitorBufferTick_.bind(this),500)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();if(e){var t={segmentInfo:Dg({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),"number"==typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}}}},{key:"isEndOfStream_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.mediaIndex,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.playlist_,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.partIndex;if(!t||!this.mediaSource_)return!1;var i="number"==typeof e&&t.segments[e],r=e+1===t.segments.length,a=!i||!i.parts||n+1===i.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&a}},{key:"chooseNextRequest_",value:function(){var e=this.buffered_(),t=wf(e)||0,n=Ef(e,this.currentTime_()),i=!this.hasPlayed_()&&n>=1,r=n>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||i||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);var s={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(s.isSyncRequest)s.mediaIndex=function(e,t,n){t=t||[];for(var i=[],r=0,a=0;a<t.length;a++){var s=t[a];if(e===s.timeline&&(i.push(a),(r+=s.duration)>n))return a}return 0===i.length?0:i[i.length-1]}(this.currentTimeline_,a,t),this.logger_("choose next request. Can not find sync point. Fallback to media Index: ".concat(s.mediaIndex));else if(null!==this.mediaIndex){var o=a[this.mediaIndex],u="number"==typeof this.partIndex?this.partIndex:-1;s.startOfSegment=o.end?o.end:t,o.parts&&o.parts[u+1]?(s.mediaIndex=this.mediaIndex,s.partIndex=u+1):s.mediaIndex=this.mediaIndex+1}else{var l,c,d,h=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_("chooseNextRequest_ request after Quality Switch:\nFor TargetTime: ".concat(h,".\nCurrentTime: ").concat(this.currentTime_(),"\nBufferedEnd: ").concat(t,"\nFetch At Buffer: ").concat(this.fetchAtBuffer_,"\n"),this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){var p=this.getSyncInfoFromMediaSequenceSync_(h);if(!p){var f="No sync info found while using media sequence sync";return this.error({message:f,metadata:{errorType:rf.Error.StreamingFailedToSelectNextSegment,error:new Error(f)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_("chooseNextRequest_ mediaSequence syncInfo (".concat(p.start," --\x3e ").concat(p.end,")")),l=p.segmentIndex,c=p.partIndex,d=p.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");var m=Hf.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:h,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});l=m.segmentIndex,c=m.partIndex,d=m.startTime}s.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd ".concat(h):"currentTime ".concat(h),s.mediaIndex=l,s.startOfSegment=d,s.partIndex=c,this.logger_("choose next request. Playlist switched and we have a sync point. Media Index: ".concat(s.mediaIndex," "))}var g=a[s.mediaIndex],v=g&&"number"==typeof s.partIndex&&g.parts&&g.parts[s.partIndex];if(!g||"number"==typeof s.partIndex&&!v)return null;"number"!=typeof s.partIndex&&g.parts&&(s.partIndex=0,v=g.parts[0]);var y=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!n&&v&&!y&&!v.independent)if(0===s.partIndex){var _=a[s.mediaIndex-1],b=_.parts&&_.parts.length&&_.parts[_.parts.length-1];b&&b.independent&&(s.mediaIndex-=1,s.partIndex=_.parts.length-1,s.independent="previous segment")}else g.parts[s.partIndex-1].independent&&(s.partIndex-=1,s.independent="previous part");var T=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return s.mediaIndex>=a.length-1&&T&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,s.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(s))}},{key:"getSyncInfoFromMediaSequenceSync_",value:function(e){if(!this.mediaSequenceSync_)return null;var t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_("getSyncInfoFromMediaSequenceSync_. Pulled target time from ".concat(e," to ").concat(t));var n=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!n)return null;if(!n.isAppended)return n;var i=this.mediaSequenceSync_.getSyncInfoForTime(n.end);return i?(i.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),i):null}},{key:"generateSegmentInfo_",value:function(e){var t=e.independent,n=e.playlist,i=e.mediaIndex,r=e.startOfSegment,a=e.isSyncRequest,s=e.partIndex,o=e.forceTimestampOffset,u=e.getMediaInfoForTime,l=n.segments[i],c="number"==typeof s&&l.parts[s],d={requestId:"segment-loader-"+Math.random(),uri:c&&c.resolvedUri||l.resolvedUri,mediaIndex:i,partIndex:c?s:null,isSyncRequest:a,startOfSegment:r,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:c&&c.duration||l.duration,segment:l,part:c,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:u,independent:t},h=void 0!==o?o:this.isPendingTimestampOffset_;d.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:h});var p=wf(this.sourceUpdater_.audioBuffered());return"number"==typeof p&&(d.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(d.gopsToAlignWith=function(e,t,n){if(null==t||!e.length)return[];var i,r=Math.ceil((t-n+3)*yu);for(i=0;i<e.length&&!(e[i].pts>r);i++);return e.slice(i)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),d}},{key:"timestampOffsetForSegment_",value:function(e){return n=(t=e).segmentTimeline,i=t.currentTimeline,r=t.startOfSegment,a=t.buffered,t.overrideCheck||n!==i?n<i?r:a.length?a.end(a.length-1):r:null;var t,n,i,r,a}},{key:"earlyAbortWhenNeeded_",value:function(e){if(!this.vhs_.tech_.paused()&&this.xhrOptions_.timeout&&this.playlist_.attributes.BANDWIDTH&&!(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)){var t=this.currentTime_(),n=e.bandwidth,i=this.pendingSegment_.duration,r=Hf.estimateSegmentRequestTime(i,n,this.playlist_,e.bytesReceived),a=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return((e.length?e.end(e.length-1):0)-t)/n}(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(!(r<=a)){var s=function(e){var t=e.main,n=e.currentTime,i=e.bandwidth,r=e.duration,a=e.segmentDuration,s=e.timeUntilRebuffer,o=e.currentTimeline,u=e.syncController,l=t.playlists.filter(function(e){return!Hf.isIncompatible(e)}),c=l.filter(Hf.isEnabled);c.length||(c=l.filter(function(e){return!Hf.isDisabled(e)}));var d=c.filter(Hf.hasAttribute.bind(null,"BANDWIDTH")).map(function(e){var t=u.getSyncPoint(e,r,o,n)?1:2;return{playlist:e,rebufferingImpact:Hf.estimateSegmentRequestTime(a,i,e)*t-s}}),h=d.filter(function(e){return e.rebufferingImpact<=0});return pg(h,function(e,t){return fg(t.playlist,e.playlist)}),h.length?h[0]:(pg(d,function(e,t){return e.rebufferingImpact-t.rebufferingImpact}),d[0]||null)}({main:this.vhs_.playlists.main,currentTime:t,bandwidth:n,duration:this.duration_(),segmentDuration:i,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(s){var o=r-a-s.rebufferingImpact,u=.5;a<=vf&&(u=1),!s.playlist||s.playlist.uri===this.playlist_.uri||o<u||(this.bandwidth=s.playlist.attributes.BANDWIDTH*xm.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}}}}},{key:"handleAbort_",value:function(e){this.logger_("Aborting ".concat(Eg(e))),this.mediaRequestsAborted+=1}},{key:"handleProgress_",value:function(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")}},{key:"handleTrackInfo_",value:function(e,t){var n=t,i=n.hasAudio,r=n.hasVideo,a={segmentInfo:Dg({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:r}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:a}),this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(t=t||{},function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;var n=Object.keys(e).sort(),i=Object.keys(t).sort();if(n.length!==i.length)return!1;for(var r=0;r<n.length;r++){var a=n[r];if(a!==i[r])return!1;if(e[a]!==t[a])return!1}return!0}(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_():Ig(this)))}},{key:"handleTimingInfo_",value:function(e,t,n,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){var r=this.pendingSegment_,a=Cg(t);r[a]=r[a]||{},r[a][n]=i,this.logger_("timinginfo: ".concat(t," - ").concat(n," - ").concat(i)),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ig(this)}}},{key:"handleCaptions_",value:function(e,t){var n=this;if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(0!==t.length)if(this.pendingSegment_.hasAppendedData_){var i=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r={};t.forEach(function(e){r[e.stream]=r[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=r[e.stream];t.startTime=Math.min(t.startTime,e.startTime+i),t.endTime=Math.max(t.endTime,e.endTime+i),t.captions.push(e)}),Object.keys(r).forEach(function(e){var t=r[e],a=t.startTime,s=t.endTime,o=t.captions,u=n.inbandTextTracks_;n.logger_("adding cues from ".concat(a," -> ").concat(s," for ").concat(e)),function(e,t,n){if(!e[n]){t.trigger({type:"usage",name:"vhs-608"});var i=n;/^cc708_/.test(n)&&(i="SERVICE"+n.split("_")[1]);var r=t.textTracks().getTrackById(i);if(r)e[n]=r;else{var a=n,s=n,o=!1,u=(t.options_.vhs&&t.options_.vhs.captionServices||{})[i];u&&(a=u.label,s=u.language,o=u.default),e[n]=t.addRemoteTextTrack({kind:"captions",id:i,default:o,label:a,language:s},!1).track}}}(u,n.vhs_.tech_,e),kg(a,s,u[e]),function(e){var t=e.inbandTextTracks,n=e.captionArray,i=e.timestampOffset;if(n){var r=wn.WebKitDataCue||wn.VTTCue;n.forEach(function(e){var n=e.stream;e.content?e.content.forEach(function(a){var s=new r(e.startTime+i,e.endTime+i,a.text);s.line=a.line,s.align="left",s.position=a.position,s.positionAlign="line-left",t[n].addCue(s)}):t[n].addCue(new r(e.startTime+i,e.endTime+i,e.text))})}}({captionArray:o,inbandTextTracks:u,timestampOffset:i})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));else this.logger_("SegmentLoader received no captions from a caption event")}},{key:"handleId3_",value:function(e,t,n){(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))||(this.pendingSegment_.hasAppendedData_?this.addMetadataToTextTrack(n,t,this.duration_()):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,n)))}},{key:"processMetadataQueue_",value:function(){this.metadataQueue_.id3.forEach(function(e){return e()}),this.metadataQueue_.caption.forEach(function(e){return e()}),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}},{key:"processCallQueue_",value:function(){var e=this.callQueue_;this.callQueue_=[],e.forEach(function(e){return e()})}},{key:"processLoadQueue_",value:function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(function(e){return e()})}},{key:"hasEnoughInfoToLoad_",value:function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!Ag({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}},{key:"getCurrentMediaInfo_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pendingSegment_;return e&&e.trackInfo||this.currentMediaInfo_}},{key:"getMediaInfo_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.pendingSegment_;return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}},{key:"getPendingSegmentPlaylist",value:function(){return this.pendingSegment_?this.pendingSegment_.playlist:null}},{key:"hasEnoughInfoToAppend_",value:function(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;var n=t.hasAudio,i=t.hasVideo,r=t.isMuxed;return!(i&&!e.videoTimingInfo)&&(!(n&&!this.audioDisabled_&&!r&&!e.audioTimingInfo)&&!Ag({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}},{key:"handleData_",value:function(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){if(this.callQueue_.length||!this.hasEnoughInfoToAppend_())return Ig(this),void this.callQueue_.push(this.handleData_.bind(this,e,t));var n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),n.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),n.isFmp4=e.isFmp4,n.timingInfo=n.timingInfo||{},n.isFmp4)this.trigger("fmp4"),n.timingInfo.start=n[Cg(t.type)].start;else{var i,r=this.getCurrentMediaInfo_(),a="main"===this.loaderType_&&r&&r.hasVideo;a&&(i=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:a,firstVideoFrameTimeForData:i,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(n,t.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:"main"===this.loaderType_});var s=this.chooseNextRequest_();if(s.mediaIndex!==n.mediaIndex||s.partIndex!==n.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,t)}}}},{key:"updateAppendInitSegmentStatus",value:function(e,t){"main"!==this.loaderType_||"number"!=typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}},{key:"getInitSegmentAndUpdateState_",value:function(e){var t=e.type,n=e.initSegment,i=e.map,r=e.playlist;if(i){var a=fm(i);if(this.activeInitSegmentId_===a)return null;n=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=a}return n&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,n):null}},{key:"handleQuotaExceededError_",value:function(e,t){var n=this,i=e.segmentInfo,r=e.type,a=e.bytes,s=this.sourceUpdater_.audioBuffered(),o=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Sf(s).join(", ")),o.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Sf(o).join(", "));var u=s.length?s.start(0):0,l=s.length?s.end(s.length-1):0,c=o.length?o.start(0):0,d=o.length?o.end(o.length-1):0;if(l-u<=1&&d-c<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. "+"Appended byte length: ".concat(a.byteLength,", ")+"audio buffer: ".concat(Sf(s).join(", "),", ")+"video buffer: ".concat(Sf(o).join(", "),", ")),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:i,type:r,bytes:a}));var h=this.currentTime_()-1;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ".concat(h)),this.remove(0,h,function(){n.logger_("On QUOTA_EXCEEDED_ERR, retrying append in ".concat(1,"s")),n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=wn.setTimeout(function(){n.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),n.quotaExceededErrorRetryTimeout_=null,n.processCallQueue_()},1e3)},!0)}},{key:"handleAppendError_",value:function(e,t){var n=e.segmentInfo,i=e.type,r=e.bytes;t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error({message:"".concat(i," append of ").concat(r.length,"b failed for segment ")+"#".concat(n.mediaIndex," in playlist ").concat(n.playlist.id),metadata:{errorType:rf.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:n,type:i,bytes:r}))}},{key:"appendToSourceBuffer_",value:function(e){var t,n,i,r=e.segmentInfo,a=e.type,s=e.initSegment,o=e.data,u=e.bytes;if(!u){var l=[o],c=o.byteLength;s&&(l.unshift(s),c+=s.byteLength),i=0,(t={bytes:c,segments:l}).bytes&&(n=new Uint8Array(t.bytes),t.segments.forEach(function(e){n.set(e,i),i+=e.byteLength})),u=n}var d={segmentInfo:Dg({type:this.loaderType_,segment:r})};this.trigger({type:"segmentappendstart",metadata:d}),this.sourceUpdater_.appendBuffer({segmentInfo:r,type:a,bytes:u},this.handleAppendError_.bind(this,{segmentInfo:r,type:a,bytes:u}))}},{key:"handleSegmentTimingInfo_",value:function(e,t,n){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var i=this.pendingSegment_.segment,r="".concat(e,"TimingInfo");i[r]||(i[r]={}),i[r].transmuxerPrependedSeconds=n.prependedContentDuration||0,i[r].transmuxedPresentationStart=n.start.presentation,i[r].transmuxedDecodeStart=n.start.decode,i[r].transmuxedPresentationEnd=n.end.presentation,i[r].transmuxedDecodeEnd=n.end.decode,i[r].baseMediaDecodeTime=n.baseMediaDecodeTime}}},{key:"appendData_",value:function(e,t){var n=t.type,i=t.data;if(i&&i.byteLength&&("audio"!==n||!this.audioDisabled_)){var r=this.getInitSegmentAndUpdateState_({type:n,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:r,data:i})}}},{key:"loadSegment_",value:function(e){var t=this;if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"==typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_())return Ig(this),void this.loadQueue_.push(function(){var n=$({},e,{forceTimestampOffset:!0});$(e,t.generateSegmentInfo_(n)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)});this.updateTransmuxerAndRequestSegment_(e)}},{key:"updateTransmuxerAndRequestSegment_",value:function(e){var t=this;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}));var n=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,a=e.timeline!==this.currentTimeline_&&e.timeline>0,s=i||r&&a;this.logger_("Requesting\n".concat(vg(e.uri),"\n").concat(Eg(e))),n.map&&!n.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=rg({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:n,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:s,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(n){var i=n.message,r=n.level,a=n.stream;t.logger_("".concat(Eg(e)," logged from transmuxer stream ").concat(a," as a ").concat(r,": ").concat(i))},triggerSegmentEventFn:function(e){var n=e.type,i=e.segment,r=e.keyInfo,a=e.trackInfo,s=e.timingInfo,o={segmentInfo:Dg({segment:i})};r&&(o.keyInfo=r),a&&(o.trackInfo=a),s&&(o.timingInfo=s),t.trigger({type:n,metadata:o})}})}},{key:"trimBackBuffer_",value:function(e){var t=function(e,t,n){var i=t-xm.BACK_BUFFER_LENGTH;e.length&&(i=Math.max(i,e.start(0)));var r=t-n;return Math.min(r,i)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}},{key:"createSimplifiedSegmentObj_",value:function(e){var t=e.segment,n=e.part,i=e.segment.key||e.segment.map&&e.segment.map.key,r=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:n?n.resolvedUri:t.resolvedUri,byterange:n?n.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:i,isMediaInitialization:r},s=e.playlist.segments[e.mediaIndex-1];if(s&&s.timeline===t.timeline&&(s.videoTimingInfo?a.baseStartTime=s.videoTimingInfo.transmuxedDecodeEnd:s.audioTimingInfo&&(a.baseStartTime=s.audioTimingInfo.transmuxedDecodeEnd)),t.key){var o=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=o}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}},{key:"saveTransferStats_",value:function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}},{key:"saveBandwidthRelatedStats_",value:function(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<wg)this.logger_("Ignoring segment's bandwidth because its duration of ".concat(e)+" is less than the min to record ".concat(wg));else{var n={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:n}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}}},{key:"handleTimeout_",value:function(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}},{key:"segmentRequestFinished_",value:function(e,t,n){if(this.callQueue_.length)this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,n));else if(this.saveTransferStats_(t.stats),this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId){if(e){if(this.pendingSegment_=null,this.state="READY",e.code===Gm)return;return this.pause(),e.code===Wm?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error"))}var i=this.pendingSegment_;this.saveBandwidthRelatedStats_(i.duration,t.stats),i.endOfAllRequests=t.endOfAllRequests,n.gopInfo&&(this.gopBuffer_=function(e,t,n){if(!t.length)return e;if(n)return t.slice();for(var i=t[0].pts,r=0;r<e.length&&!(e[r].pts>=i);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,n.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(i)}}},{key:"setTimeMapping_",value:function(e){var t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)}},{key:"updateMediaSecondsLoaded_",value:function(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}},{key:"shouldUpdateTransmuxerTimestampOffset_",value:function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())}},{key:"trueSegmentStart_",value:function(e){var t=e.currentStart,n=e.playlist,i=e.mediaIndex,r=e.firstVideoFrameTimeForData,a=e.currentVideoTimestampOffset,s=e.useVideoTimingInfo,o=e.videoTimingInfo,u=e.audioTimingInfo;if(void 0!==t)return t;if(!s)return u.start;var l=n.segments[i-1];return 0!==i&&l&&void 0!==l.start&&l.end===r+a?o.start:r}},{key:"waitForAppendsToComplete_",value:function(e){var t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),void this.trigger("error");var n=t.hasAudio,i=t.hasVideo,r=t.isMuxed,a="main"===this.loaderType_&&i,s=!this.audioDisabled_&&n&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);a&&e.waitingOnAppends++,s&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}},{key:"checkAppendsDone_",value:function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())}},{key:"checkForIllegalMediaSwitch",value:function(e){var t=function(e,t,n){return"main"===e&&t&&n?n.hasAudio||n.hasVideo?t.hasVideo&&!n.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.":!t.hasVideo&&n.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:"Neither audio nor video found in segment.":null}(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0)}},{key:"updateSourceBufferTimestampOffset_",value:function(e){if(null!==e.timestampOffset&&"number"==typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){var 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")}}},{key:"getSegmentStartTimeForTimestampOffsetCalculation_",value:function(e){var t=e.videoTimingInfo,n=e.audioTimingInfo,i=e.timingInfo;return this.useDtsForTimestampOffset_?t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:n&&"number"==typeof n.transmuxedDecodeStart?n.transmuxedDecodeStart:i.start:i.start}},{key:"updateTimingInfoEnd_",value:function(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),n="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;n&&(e.timingInfo.end="number"==typeof n.end?n.end:n.start+e.duration)}},{key:"handleAppendsDone_",value:function(){if(this.pendingSegment_){var e={segmentInfo:Dg({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:e})}if(!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var t=this.pendingSegment_;t.part&&t.part.syncInfo?t.part.syncInfo.markAppended():t.segment.syncInfo&&t.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(t),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:t,shouldSaveTimelineMapping:"main"===this.loaderType_});var n=Lg(t,this.sourceType_);if(n&&("warn"===n.severity?rf.log.warn(n.message):this.logger_(n.message)),this.recordThroughput_(t),this.pendingSegment_=null,this.state="READY",!t.isSyncRequest||(this.trigger("syncinfoupdate"),t.hasAppendedData_)){this.logger_("Appended ".concat(Eg(t))),this.addSegmentMetadataCue_(t),this.fetchAtBuffer_=!0,this.currentTimeline_!==t.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:t.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:t.timeline})),this.currentTimeline_=t.timeline,this.trigger("syncinfoupdate");var i=t.segment,r=t.part,a=i.end&&this.currentTime_()-i.end>3*t.playlist.targetDuration,s=r&&r.end&&this.currentTime_()-r.end>3*t.playlist.partTargetDuration;if(a||s)return this.logger_("bad ".concat(a?"segment":"part"," ").concat(Eg(t))),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=t.mediaIndex,this.partIndex=t.partIndex,this.isEndOfStream_(t.mediaIndex,t.playlist,t.partIndex)&&this.endOfStream(),this.trigger("appended"),t.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}else this.logger_("Throwing away un-appended sync request ".concat(Eg(t)))}},{key:"recordThroughput_",value:function(e){if(e.duration<wg)this.logger_("Ignoring segment's throughput because its duration of ".concat(e.duration)+" is less than the min to record ".concat(wg));else{var t=this.throughput.rate,n=Date.now()-e.endOfAllRequests+1,i=Math.floor(e.byteLength/n*8*1e3);this.throughput.rate+=(i-t)/++this.throughput.count}}},{key:"addSegmentMetadataCue_",value:function(e){if(this.segmentMetadataTrack_){var t=e.segment,n=t.start,i=t.end;if(Sg(n)&&Sg(i)){kg(n,i,this.segmentMetadataTrack_);var r=wn.WebKitDataCue||wn.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:n,end:i},s=new r(n,i,JSON.stringify(a));s.value=a,this.segmentMetadataTrack_.addCue(s)}}}}])}();function Rg(){}var Og,Ng=function(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toUpperCase()})},Ug=["video","audio"],Mg=function(e,t){var n=t["".concat(e,"Buffer")];return n&&n.updating||t.queuePending[e]},Bg=function(e,t){if(0!==t.queue.length){var n=0,i=t.queue[n];if("mediaSource"!==i.type){if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!Mg(e,t)){if(i.type!==e){if(n=function(e,t){for(var n=0;n<t.length;n++){var i=t[n];if("mediaSource"===i.type)return null;if(i.type===e)return n}return null}(e,t.queue),null===n)return;i=t.queue[n]}return t.queue.splice(n,1),t.queuePending[e]=i,i.action(e,t),i.doneFn?void 0:(t.queuePending[e]=null,void Bg(e,t))}}else t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),i.action(t),i.doneFn&&i.doneFn(),Bg("audio",t),Bg("video",t))}},jg=function(e,t){var n=t["".concat(e,"Buffer")],i=Ng(e);n&&(n.removeEventListener("updateend",t["on".concat(i,"UpdateEnd_")]),n.removeEventListener("error",t["on".concat(i,"Error_")]),t.codecs[e]=null,t["".concat(e,"Buffer")]=null)},Fg=function(e,t){return e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t)},qg=function(e,t,n){return function(i,r){var a=r["".concat(i,"Buffer")];if(Fg(r.mediaSource,a)){r.logger_("Appending segment ".concat(t.mediaIndex,"'s ").concat(e.length," bytes to ").concat(i,"Buffer"));try{a.appendBuffer(e)}catch(vy){r.logger_("Error with code ".concat(vy.code," ")+(22===vy.code?"(QUOTA_EXCEEDED_ERR) ":"")+"when appending segment ".concat(t.mediaIndex," to ").concat(i,"Buffer")),r.queuePending[i]=null,n(vy)}}}},Vg=function(e,t){return function(n,i){var r=i["".concat(n,"Buffer")];if(Fg(i.mediaSource,r)){i.logger_("Removing ".concat(e," to ").concat(t," from ").concat(n,"Buffer"));try{r.remove(e,t)}catch(vy){i.logger_("Remove ".concat(e," to ").concat(t," from ").concat(n,"Buffer failed"))}}}},Hg=function(e){return function(t,n){var i=n["".concat(t,"Buffer")];Fg(n.mediaSource,i)&&(n.logger_("Setting ".concat(t,"timestampOffset to ").concat(e)),i.timestampOffset=e)}},zg=function(e){return function(t,n){e()}},Wg=function(e){return function(t){if("open"===t.mediaSource.readyState){t.logger_("Calling mediaSource endOfStream(".concat(e||"",")"));try{t.mediaSource.endOfStream(e)}catch(vy){rf.log.warn("Failed to call media source endOfStream",vy)}}}},Gg=function(e){return function(t){t.logger_("Setting mediaSource duration to ".concat(e));try{t.mediaSource.duration=e}catch(vy){rf.log.warn("Failed to set media source duration",vy)}}},Xg=function(){return function(e,t){if("open"===t.mediaSource.readyState){var n=t["".concat(e,"Buffer")];if(Fg(t.mediaSource,n)){t.logger_("calling abort on ".concat(e,"Buffer"));try{n.abort()}catch(vy){rf.log.warn("Failed to abort on ".concat(e,"Buffer"),vy)}}}}},Kg=function(e,t){return function(n){var i=Ng(e),r=yr(t);n.logger_("Adding ".concat(e,"Buffer with codec ").concat(t," to mediaSource"));var a=n.mediaSource.addSourceBuffer(r);a.addEventListener("updateend",n["on".concat(i,"UpdateEnd_")]),a.addEventListener("error",n["on".concat(i,"Error_")]),n.codecs[e]=t,n["".concat(e,"Buffer")]=a}},Yg=function(e){return function(t){var n=t["".concat(e,"Buffer")];if(jg(e,t),Fg(t.mediaSource,n)){t.logger_("Removing ".concat(e,"Buffer with codec ").concat(t.codecs[e]," from mediaSource"));try{t.mediaSource.removeSourceBuffer(n)}catch(vy){rf.log.warn("Failed to removeSourceBuffer ".concat(e,"Buffer"),vy)}}}},Qg=function(e){return function(t,n){var i=n["".concat(t,"Buffer")],r=yr(e);if(Fg(n.mediaSource,i)){var a=e.substring(0,e.indexOf(".")),s=n.codecs[t];if(s.substring(0,s.indexOf("."))!==a){var o={codecsChangeInfo:{from:s,to:e}};n.trigger({type:"codecschange",metadata:o}),n.logger_("changing ".concat(t,"Buffer codec from ").concat(s," to ").concat(e));try{i.changeType(r),n.codecs[t]=e}catch(vy){o.errorType=rf.Error.StreamingCodecsChangeError,o.error=vy,vy.metadata=o,n.error_=vy,n.trigger("error"),rf.log.warn("Failed to changeType on ".concat(t,"Buffer"),vy)}}}}},$g=function(e){var t=e.type,n=e.sourceUpdater,i=e.action,r=e.doneFn,a=e.name;n.queue.push({type:t,action:i,doneFn:r,name:a}),Bg(t,n)},Jg=function(e,t){return function(n){var i=function(e){if(0===e.length)return"Buffered Ranges are empty";for(var t="Buffered Ranges: \n",n=0;n<e.length;n++){var i=e.start(n),r=e.end(n);t+="".concat(i," --\x3e ").concat(r,". Duration (").concat(r-i,")\n")}return t}(t["".concat(e,"Buffered")]());if(t.logger_('received "updateend" event for '.concat(e," Source Buffer: "),i),t.queuePending[e]){var r=t.queuePending[e].doneFn;t.queuePending[e]=null,r&&r(t["".concat(e,"Error_")])}Bg(e,t)}},Zg=function(){function e(t){var n;return g(this,e),(n=c(this,e)).mediaSource=t,n.sourceopenListener_=function(){return Bg("mediaSource",n)},n.mediaSource.addEventListener("sourceopen",n.sourceopenListener_),n.logger_=ff("SourceUpdater"),n.audioTimestampOffset_=0,n.videoTimestampOffset_=0,n.queue=[],n.queuePending={audio:null,video:null},n.delayedAudioAppendQueue_=[],n.videoAppendQueued_=!1,n.codecs={},n.onVideoUpdateEnd_=Jg("video",n),n.onAudioUpdateEnd_=Jg("audio",n),n.onVideoError_=function(e){n.videoError_=e},n.onAudioError_=function(e){n.audioError_=e},n.createdSourceBuffers_=!1,n.initializedEme_=!1,n.triggeredReady_=!1,n}return f(e,rf.EventTarget),y(e,[{key:"initializedEme",value:function(){this.initializedEme_=!0,this.triggerReady()}},{key:"hasCreatedSourceBuffers",value:function(){return this.createdSourceBuffers_}},{key:"hasInitializedAnyEme",value:function(){return this.initializedEme_}},{key:"ready",value:function(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}},{key:"createSourceBuffers",value:function(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}},{key:"triggerReady",value:function(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}},{key:"addSourceBuffer",value:function(e,t){$g({type:"mediaSource",sourceUpdater:this,action:Kg(e,t),name:"addSourceBuffer"})}},{key:"abort",value:function(e){$g({type:e,sourceUpdater:this,action:Xg(e),name:"abort"})}},{key:"removeSourceBuffer",value:function(e){this.canRemoveSourceBuffer()?$g({type:"mediaSource",sourceUpdater:this,action:Yg(e),name:"removeSourceBuffer"}):rf.log.error("removeSourceBuffer is not supported!")}},{key:"canRemoveSourceBuffer",value:function(){return!rf.browser.IS_FIREFOX&&wn.MediaSource&&wn.MediaSource.prototype&&"function"==typeof wn.MediaSource.prototype.removeSourceBuffer}},{key:"canChangeType",value:function(){return this.constructor.canChangeType()}},{key:"changeType",value:function(e,t){this.canChangeType()?$g({type:e,sourceUpdater:this,action:Qg(t),name:"changeType"}):rf.log.error("changeType is not supported!")}},{key:"addOrChangeSourceBuffers",value:function(e){var t=this;if(!e||"object"!==k(e)||0===Object.keys(e).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(function(n){var i=e[n];if(!t.hasCreatedSourceBuffers())return t.addSourceBuffer(n,i);t.canChangeType()&&t.changeType(n,i)})}},{key:"appendBuffer",value:function(e,t){var n=this,i=e.segmentInfo,r=e.type,a=e.bytes;if(this.processedAppend_=!0,"audio"===r&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_("delayed audio append of ".concat(a.length," until video append"));if($g({type:r,sourceUpdater:this,action:qg(a,i||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===r){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;var s=this.delayedAudioAppendQueue_.slice();this.logger_("queuing delayed audio ".concat(s.length," appendBuffers")),this.delayedAudioAppendQueue_.length=0,s.forEach(function(e){n.appendBuffer.apply(n,e)})}}},{key:"audioBuffered",value:function(){return Fg(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:gf()}},{key:"videoBuffered",value:function(){return Fg(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:gf()}},{key:"buffered",value:function(){var e=Fg(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Fg(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){var n=null,i=null,r=0,a=[],s=[];if(!(e&&e.length&&t&&t.length))return gf();for(var o=e.length;o--;)a.push({time:e.start(o),type:"start"}),a.push({time:e.end(o),type:"end"});for(o=t.length;o--;)a.push({time:t.start(o),type:"start"}),a.push({time:t.end(o),type:"end"});for(a.sort(function(e,t){return e.time-t.time}),o=0;o<a.length;o++)"start"===a[o].type?2===++r&&(n=a[o].time):"end"===a[o].type&&1===--r&&(i=a[o].time),null!==n&&null!==i&&(s.push([n,i]),n=null,i=null);return gf(s)}(this.audioBuffered(),this.videoBuffered())}},{key:"setDuration",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rg;$g({type:"mediaSource",sourceUpdater:this,action:Gg(e),name:"duration",doneFn:t})}},{key:"endOfStream",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rg;"string"!=typeof e&&(e=void 0),$g({type:"mediaSource",sourceUpdater:this,action:Wg(e),name:"endOfStream",doneFn:t})}},{key:"removeAudio",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Rg;this.audioBuffered().length&&0!==this.audioBuffered().end(0)?$g({type:"audio",sourceUpdater:this,action:Vg(e,t),doneFn:n,name:"remove"}):n()}},{key:"removeVideo",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Rg;this.videoBuffered().length&&0!==this.videoBuffered().end(0)?$g({type:"video",sourceUpdater:this,action:Vg(e,t),doneFn:n,name:"remove"}):n()}},{key:"updating",value:function(){return!(!Mg("audio",this)&&!Mg("video",this))}},{key:"audioTimestampOffset",value:function(e){return void 0!==e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&($g({type:"audio",sourceUpdater:this,action:Hg(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}},{key:"videoTimestampOffset",value:function(e){return void 0!==e&&this.videoBuffer&&this.videoTimestampOffset_!==e&&($g({type:"video",sourceUpdater:this,action:Hg(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}},{key:"audioQueueCallback",value:function(e){this.audioBuffer&&$g({type:"audio",sourceUpdater:this,action:zg(e),name:"callback"})}},{key:"videoQueueCallback",value:function(e){this.videoBuffer&&$g({type:"video",sourceUpdater:this,action:zg(e),name:"callback"})}},{key:"dispose",value:function(){var e=this;this.trigger("dispose"),Ug.forEach(function(t){e.abort(t),e.canRemoveSourceBuffer()?e.removeSourceBuffer(t):e["".concat(t,"QueueCallback")](function(){return jg(t,e)})}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}],[{key:"canChangeType",value:function(){return wn.SourceBuffer&&wn.SourceBuffer.prototype&&"function"==typeof wn.SourceBuffer.prototype.changeType}}])}(),ev=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))},tv=new Uint8Array("\n\n".split("").map(function(e){return e.charCodeAt(0)})),nv=function(){function t(){return g(this,t),c(this,t,["Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded."])}return f(t,e(Error)),y(t)}(),iv=function(){function e(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return g(this,e),(n=c(this,e,[t,i])).mediaSource_=null,n.subtitlesTrack_=null,n.featuresNativeTextTracks_=t.featuresNativeTextTracks,n.loadVttJs=t.loadVttJs,n.shouldSaveSegmentTimingInfo_=!1,n}return f(e,Pg),y(e,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return gf();var e=this.subtitlesTrack_.cues;return gf([[e[0].startTime,e[e.length-1].startTime]])}},{key:"initSegmentForMap",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;var n=fm(e),i=this.initSegments_[n];if(t&&!i&&e.bytes){var r=tv.byteLength+e.bytes.byteLength,a=new Uint8Array(r);a.set(e.bytes),a.set(tv,e.bytes.byteLength),this.initSegments_[n]=i={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return i||e}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"track",value:function(e){return void 0===e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_}},{key:"remove",value:function(e,t){kg(e,t,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var e=this,t=this.chooseNextRequest_();if(t){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline)){return this.syncController_.one("timestampoffset",function(){e.state="READY",e.paused()||e.monitorBuffer_()}),void(this.state="WAITING_ON_TIMELINE")}this.loadSegment_(t)}}},{key:"timestampOffsetForSegment_",value:function(){return null}},{key:"chooseNextRequest_",value:function(){return this.skipEmptySegments_(n(e,"chooseNextRequest_",this,3)([]))}},{key:"skipEmptySegments_",value:function(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}},{key:"stopForError",value:function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}},{key:"segmentRequestFinished_",value:function(e,t,n){var i=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===Wm&&this.handleTimeout_(),e.code===Gm?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var r=this.pendingSegment_,a=n.mp4VttCues&&n.mp4VttCues.length;a&&(r.mp4VttCues=n.mp4VttCues),this.saveBandwidthRelatedStats_(r.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");var s=r.segment;if(s.map&&(s.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof wn.WebVTT&&"function"==typeof this.loadVttJs)return this.state="WAITING_ON_VTTJS",void this.loadVttJs().then(function(){return i.segmentRequestFinished_(e,t,n)},function(){return i.stopForError({message:"Error loading vtt.js"})});s.requested=!0;try{this.parseVTTCues_(r)}catch(vy){return void this.stopForError({message:vy.message,metadata:{errorType:rf.Error.StreamingVttParserError,error:vy}})}if(a||this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=s.duration,r.cues.forEach(function(e){i.subtitlesTrack_.addCue(i.featuresNativeTextTracks_?new wn.VTTCue(e.startTime,e.endTime,e.text):e)}),function(e){var t=e.cues;if(t)for(var n={},i=t.length-1;i>=0;i--){var r=t[i],a="".concat(r.startTime,"-").concat(r.endTime,"-").concat(r.text);n[a]?e.removeCue(r):n[a]=r}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"}},{key:"handleData_",value:function(t,i){var r=t&&"vtt"===t.type,a=i&&"text"===i.type;r&&a&&n(e,"handleData_",this,3)([t,i])}},{key:"updateTimingInfoEnd_",value:function(){}},{key:"parseMp4VttCues_",value:function(e){var t=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(function(n){var i=n.start+t,r=n.end+t,a=new wn.VTTCue(i,r,n.cueText);n.settings&&n.settings.split(" ").forEach(function(e){var t=e.split(":"),n=t[0],i=t[1];a[n]=isNaN(i)?i:Number(i)}),e.cues.push(a)})}},{key:"parseVTTCues_",value:function(e){var t,n=!1;if("function"!=typeof wn.WebVTT)throw new nv;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues)this.parseMp4VttCues_(e);else{"function"==typeof wn.TextDecoder?t=new wn.TextDecoder("utf8"):(t=wn.WebVTT.StringDecoder(),n=!0);var i=new wn.WebVTT.Parser(wn,wn.vttjs,t);if(i.oncue=e.cues.push.bind(e.cues),i.ontimestampmap=function(t){e.timestampmap=t},i.onparsingerror=function(e){rf.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var r=e.segment.map.bytes;n&&(r=ev(r)),i.parse(r)}var a=e.bytes;n&&(a=ev(a)),i.parse(a),i.flush()}}},{key:"updateTimeMapping_",value:function(e,t,n){var i=this,r=e.segment;if(t)if(e.cues.length){var a=e.timestampmap,s=a.MPEGTS,o=a.LOCAL,u=s/yu-o+t.mapping;if(e.cues.forEach(function(e){var n=e.endTime-e.startTime,r=i.handleRollover_(e.startTime+u,t.time);e.startTime=Math.max(r,0),e.endTime=Math.max(r+n,0)}),!n.syncInfo){var l=e.cues[0].startTime,c=e.cues[e.cues.length-1].startTime;n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:Math.min(l,c-r.duration)}}}else r.empty=!0}},{key:"handleRollover_",value:function(e,t){if(null===t)return e;var n,i=e*yu,r=t*yu;for(n=r<i?-8589934592:8589934592;Math.abs(i-r)>4294967296;)i+=n;return i/yu}}])}(),rv=function(e,t){for(var n=e.cues,i=0;i<n.length;i++){var r=n[i];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null},av=function(){return y(function e(t){var n=t.start,i=t.end,r=t.segmentIndex,a=t.partIndex,s=void 0===a?null:a,o=t.appended,u=void 0!==o&&o;g(this,e),this.start_=n,this.end_=i,this.segmentIndex_=r,this.partIndex_=s,this.appended_=u},[{key:"isInRange",value:function(e){return e>=this.start&&e<this.end}},{key:"markAppended",value:function(){this.appended_=!0}},{key:"resetAppendedStatus",value:function(){this.appended_=!1}},{key:"isAppended",get:function(){return this.appended_}},{key:"start",get:function(){return this.start_}},{key:"end",get:function(){return this.end_}},{key:"segmentIndex",get:function(){return this.segmentIndex_}},{key:"partIndex",get:function(){return this.partIndex_}}])}(),sv=function(){return y(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];g(this,e),this.segmentSyncInfo_=t,this.partsSyncInfo_=n},[{key:"segmentSyncInfo",get:function(){return this.segmentSyncInfo_}},{key:"partsSyncInfo",get:function(){return this.partsSyncInfo_}},{key:"hasPartsSyncInfo",get:function(){return this.partsSyncInfo_.length>0}},{key:"resetAppendStatus",value:function(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(function(e){return e.resetAppendedStatus()})}}])}(),ov=function(){return y(function e(){g(this,e),this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0},[{key:"start",get:function(){return this.start_}},{key:"end",get:function(){return this.end_}},{key:"diagnostics",get:function(){return this.diagnostics_}},{key:"isReliable",get:function(){return this.isReliable_}},{key:"resetAppendedStatus",value:function(){this.storage_.forEach(function(e){return e.resetAppendStatus()})}},{key:"update",value:function(e,t){var n=e.mediaSequence,i=e.segments;if(this.isReliable_=this.isReliablePlaylist_(n,i),this.isReliable_)return this.updateStorage_(i,n,this.calculateBaseTime_(n,i,t))}},{key:"getSyncInfoForTime",value:function(e){var t,n=_(this.storage_.values());try{for(n.s();!(t=n.n()).done;){var i=t.value,r=i.segmentSyncInfo,a=i.partsSyncInfo;if(a.length){var s,o=_(a);try{for(o.s();!(s=o.n()).done;){var u=s.value;if(u.isInRange(e))return u}}catch(l){o.e(l)}finally{o.f()}}else if(r.isInRange(e))return r}}catch(l){n.e(l)}finally{n.f()}return null}},{key:"getSyncInfoForMediaSequence",value:function(e){return this.storage_.get(e)}},{key:"updateStorage_",value:function(e,t,n){var i=this,r=new Map,a="\n",s=n,o=t;this.start_=s,e.forEach(function(e,t){var n=i.storage_.get(o),u=s,l=u+e.duration,c=Boolean(n&&n.segmentSyncInfo&&n.segmentSyncInfo.isAppended),d=new av({start:u,end:l,appended:c,segmentIndex:t});e.syncInfo=d;var h=s,p=(e.parts||[]).map(function(e,i){var r=h,s=h+e.duration,u=Boolean(n&&n.partsSyncInfo&&n.partsSyncInfo[i]&&n.partsSyncInfo[i].isAppended),l=new av({start:r,end:s,appended:u,segmentIndex:t,partIndex:i});return h=s,a+="Media Sequence: ".concat(o,".").concat(i," | Range: ").concat(r," --\x3e ").concat(s," | Appended: ").concat(u,"\n"),e.syncInfo=l,l});r.set(o,new sv(d,p)),a+="".concat(vg(e.resolvedUri)," | Media Sequence: ").concat(o," | Range: ").concat(u," --\x3e ").concat(l," | Appended: ").concat(c,"\n"),o++,s=l}),this.end_=s,this.storage_=r,this.diagnostics_=a}},{key:"calculateBaseTime_",value:function(e,t,n){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;var i=Math.min.apply(Math,b(this.storage_.keys()));if(e<i){for(var r=i-e,a=this.storage_.get(i).segmentSyncInfo.start,s=0;s<r;s++){a-=t[s].duration}return a}return n}},{key:"isReliablePlaylist_",value:function(e,t){return null!=e&&Array.isArray(t)&&t.length}}])}(),uv=function(){function e(t){var n;return g(this,e),(n=c(this,e)).parent_=t,n}return f(e,ov),y(e,[{key:"calculateBaseTime_",value:function(t,i,r){if(!this.storage_.size){var a=this.parent_.getSyncInfoForMediaSequence(t);return a?a.segmentSyncInfo.start:0}return n(e,"calculateBaseTime_",this,3)([t,i,r])}}])}(),lv=[{name:"VOD",run:function(e,t,n,i,r){if(n!==1/0){return{time:0,segmentIndex:0,partIndex:null}}return null}},{name:"MediaSequence",run:function(e,t,n,i,r,a){var s=e.getMediaSequenceSync(a);if(!s)return null;if(!s.isReliable)return null;var o=s.getSyncInfoForTime(r);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:function(e,t,n,i,r){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var a=null,s=null,o=Af(t);r=r||0;for(var u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],c=l.segment,d=e.timelineToDatetimeMappings[c.timeline];if(d&&c.dateTimeObject){var h=c.dateTimeObject.getTime()/1e3+d;if(c.parts&&"number"==typeof l.partIndex)for(var p=0;p<l.partIndex;p++)h+=c.parts[p].duration;var f=Math.abs(r-h);if(null!==s&&(0===f||s<f))break;s=f,a={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex}}}return a}},{name:"Segment",run:function(e,t,n,i,r){var a=null,s=null;r=r||0;for(var o=Af(t),u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],c=l.segment,d=l.part&&l.part.start||c&&c.start;if(c.timeline===i&&void 0!==d){var h=Math.abs(r-d);if(null!==s&&s<h)break;(!a||null===s||s>=h)&&(s=h,a={time:d,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return a}},{name:"Discontinuity",run:function(e,t,n,i,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o<t.discontinuityStarts.length;o++){var u=t.discontinuityStarts[o],l=t.discontinuitySequence+o+1,c=e.discontinuities[l];if(c){var d=Math.abs(r-c.time);if(null!==s&&s<d)break;(!a||null===s||s>=d)&&(s=d,a={time:c.time,segmentIndex:u,partIndex:null})}}return a}},{name:"Playlist",run:function(e,t,n,i,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],cv=function(){function e(){var t;g(this,e),(t=c(this,e)).timelines=[],t.discontinuities=[],t.timelineToDatetimeMappings={};var n=new ov,i=new uv(n),r=new uv(n);return t.mediaSequenceStorage_={main:n,audio:i,vtt:r},t.logger_=ff("SyncController"),t}return f(e,rf.EventTarget),y(e,[{key:"getMediaSequenceSync",value:function(e){return this.mediaSequenceStorage_[e]||null}},{key:"getSyncPoint",value:function(e,t,n,i,r){if(t!==1/0)return lv.find(function(e){return"VOD"===e.name}).run(this,e,t);var a=this.runStrategies_(e,t,n,i,r);if(!a.length)return null;var s,o=_(a);try{for(o.s();!(s=o.n()).done;){var u=s.value,l=u.syncPoint,c=u.strategy,d=l.segmentIndex,h=l.time;if(!(d<0)){var p=e.segments[d],f=h,m=f+p.duration;if(this.logger_("Strategy: ".concat(c,". Current time: ").concat(i,". selected segment: ").concat(d,". Time: [").concat(f," -> ").concat(m,"]}")),i>=f&&i<m)return this.logger_("Found sync point with exact match: ",l),l}}}catch(g){o.e(g)}finally{o.f()}return this.selectSyncPoint_(a,{key:"time",value:i})}},{key:"getExpiredTime",value:function(e,t){if(!e||!e.segments)return null;var n=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!n.length)return null;var i=this.selectSyncPoint_(n,{key:"segmentIndex",value:0});return i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+Rf({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:i.segmentIndex,endIndex:0}))}},{key:"runStrategies_",value:function(e,t,n,i,r){for(var a=[],s=0;s<lv.length;s++){var o=lv[s],u=o.run(this,e,t,n,i,r);u&&(u.strategy=o.name,a.push({strategy:o.name,syncPoint:u}))}return a}},{key:"selectSyncPoint_",value:function(e,t){for(var n=e[0].syncPoint,i=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,a=1;a<e.length;a++){var s=Math.abs(e[a].syncPoint[t.key]-t.value);s<i&&(i=s,n=e[a].syncPoint,r=e[a].strategy)}return this.logger_("syncPoint for [".concat(t.key,": ").concat(t.value,"] chosen with strategy")+" [".concat(r,"]: [time:").concat(n.time,",")+" segmentIndex:".concat(n.segmentIndex)+("number"==typeof n.partIndex?",partIndex:".concat(n.partIndex):"")+"]"),n}},{key:"saveExpiredSegmentInfo",value:function(e,t){var n=t.mediaSequence-e.mediaSequence;if(n>86400)rf.log.warn("Not saving expired segment info. Media sequence gap ".concat(n," is too large."));else for(var i=n-1;i>=0;i--){var r=e.segments[i];if(r&&void 0!==r.start){t.syncInfo={mediaSequence:e.mediaSequence+i,time:r.start},this.logger_("playlist refresh sync: [time:".concat(t.syncInfo.time,",")+" mediaSequence: ".concat(t.syncInfo.mediaSequence,"]")),this.trigger("syncinfoupdate");break}}}},{key:"setDateTimeMappingForStart",value:function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],n=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-n}}},{key:"saveSegmentTimingInfo",value:function(e){var t=e.segmentInfo,n=e.shouldSaveTimelineMapping,i=this.calculateSegmentTimeMapping_(t,t.timingInfo,n),r=t.segment;i&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:r.start}));var a=r.dateTimeObject;r.discontinuity&&n&&a&&(this.timelineToDatetimeMappings[r.timeline]=-a.getTime()/1e3)}},{key:"timestampOffsetForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].time}},{key:"mappingForTimeline",value:function(e){return void 0===this.timelines[e]?null:this.timelines[e].mapping}},{key:"calculateSegmentTimeMapping_",value:function(e,t,n){var i,r,a=e.segment,s=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},n&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_("time mapping for timeline ".concat(e.timeline,": ")+"[time: ".concat(o.time,"] [mapping: ").concat(o.mapping,"]"))),i=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;i=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=i,s.end=r),(!a.start||i<a.start)&&(a.start=i),a.end=r,!0}},{key:"saveDiscontinuitySyncInfo_",value:function(e){var t=e.playlist,n=e.segment;if(n.discontinuity)this.discontinuities[n.timeline]={time:n.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var i=0;i<t.discontinuityStarts.length;i++){var r=t.discontinuityStarts[i],a=t.discontinuitySequence+i+1,s=r-e.mediaIndex,o=Math.abs(s);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>o){var u=void 0;u=s<0?n.start-Rf({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):n.end+Rf({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:u,accuracy:o}}}}},{key:"dispose",value:function(){this.trigger("dispose"),this.off()}}])}(),dv=function(){function e(){var t;return g(this,e),(t=c(this,e)).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}return f(e,rf.EventTarget),y(e,[{key:"clearPendingTimelineChange",value:function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}},{key:"pendingTimelineChange",value:function(e){var t=e.type,n=e.from,i=e.to;return"number"==typeof n&&"number"==typeof i&&(this.pendingTimelineChanges_[t]={type:t,from:n,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]}},{key:"lastTimelineChange",value:function(e){var t=e.type,n=e.from,i=e.to;if("number"==typeof n&&"number"==typeof i){this.lastTimelineChanges_[t]={type:t,from:n,to:i},delete this.pendingTimelineChanges_[t];var r={timelineChangeInfo:{from:n,to:i}};this.trigger({type:"timelinechange",metadata:r})}return this.lastTimelineChanges_[t]}},{key:"dispose",value:function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}])}(),hv=Pm(Rm(function(){var e=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var n=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(n,1),n>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var n=t.length,i=0;i<n;++i)t[i].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(e){this.on("data",function(t){e.push(t)})},e}();
26
+ /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
27
+ /*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */
28
+ var t,n=null,i=function(){return y(function e(t){var i,r,a;g(this,e),n||(n=function(){var e,t,n,i,r,a,s,o,u=[[[],[],[],[],[]],[[],[],[],[],[]]],l=u[0],c=u[1],d=l[4],h=c[4],p=[],f=[];for(e=0;e<256;e++)f[(p[e]=e<<1^283*(e>>7))^e]=e;for(t=n=0;!d[t];t^=i||1,n=f[n]||1)for(a=(a=n^n<<1^n<<2^n<<3^n<<4)>>8^255&a^99,d[t]=a,h[a]=t,o=16843009*p[r=p[i=p[t]]]^65537*r^257*i^16843008*t,s=257*p[a]^16843008*a,e=0;e<4;e++)l[e][t]=s=s<<24^s>>>8,c[e][a]=o=o<<24^o>>>8;for(e=0;e<5;e++)l[e]=l[e].slice(0),c[e]=c[e].slice(0);return u}()),this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];var s=this._tables[0][4],o=this._tables[1],u=t.length,l=1;if(4!==u&&6!==u&&8!==u)throw new Error("Invalid aes key size");var c=t.slice(0),d=[];for(this._key=[c,d],i=u;i<4*u+28;i++)a=c[i-1],(i%u===0||8===u&&i%u===4)&&(a=s[a>>>24]<<24^s[a>>16&255]<<16^s[a>>8&255]<<8^s[255&a],i%u===0&&(a=a<<8^a>>>24^l<<24,l=l<<1^283*(l>>7))),c[i]=c[i-u]^a;for(r=0;i;r++,i--)a=c[3&r?i:i-4],d[r]=i<=4||r<4?a:o[0][s[a>>>24]]^o[1][s[a>>16&255]]^o[2][s[a>>8&255]]^o[3][s[255&a]]},[{key:"decrypt",value:function(e,t,n,i,r,a){var s,o,u,l,c=this._key[1],d=e^c[0],h=i^c[1],p=n^c[2],f=t^c[3],m=c.length/4-2,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],k=v[4];for(l=0;l<m;l++)s=y[d>>>24]^_[h>>16&255]^b[p>>8&255]^T[255&f]^c[g],o=y[h>>>24]^_[p>>16&255]^b[f>>8&255]^T[255&d]^c[g+1],u=y[p>>>24]^_[f>>16&255]^b[d>>8&255]^T[255&h]^c[g+2],f=y[f>>>24]^_[d>>16&255]^b[h>>8&255]^T[255&p]^c[g+3],g+=4,d=s,h=o,p=u;for(l=0;l<4;l++)r[(3&-l)+a]=k[d>>>24]<<24^k[h>>16&255]<<16^k[p>>8&255]<<8^k[255&f]^c[g++],s=d,d=h,h=p,p=f,f=s}}])}(),r=function(t){function n(){var t;return g(this,n),(t=c(this,n,[e])).jobs=[],t.delay=1,t.timeout_=null,t}return f(n,t),y(n,[{key:"processJob_",value:function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}},{key:"push",value:function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}])}(e),a=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},s=function(){return y(function e(t,n,i,s){g(this,e);var o=e.STEP,u=new Int32Array(t.buffer),l=new Uint8Array(t.byteLength),c=0;for(this.asyncStream_=new r,this.asyncStream_.push(this.decryptChunk_(u.subarray(c,c+o),n,i,l)),c=o;c<u.length;c+=o)i=new Uint32Array([a(u[c-4]),a(u[c-3]),a(u[c-2]),a(u[c-1])]),this.asyncStream_.push(this.decryptChunk_(u.subarray(c,c+o),n,i,l));this.asyncStream_.push(function(){var e;s(null,(e=l).subarray(0,e.byteLength-e[e.byteLength-1]))})},[{key:"decryptChunk_",value:function(e,t,n,r){return function(){var s=function(e,t,n){var r,s,o,u,l,c,d,h,p,f=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),m=new i(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),v=new Int32Array(g.buffer);for(r=n[0],s=n[1],o=n[2],u=n[3],p=0;p<f.length;p+=4)l=a(f[p]),c=a(f[p+1]),d=a(f[p+2]),h=a(f[p+3]),m.decrypt(l,c,d,h,v,p),v[p]=a(v[p]^r),v[p+1]=a(v[p+1]^s),v[p+2]=a(v[p+2]^o),v[p+3]=a(v[p+3]^u),r=l,s=c,o=d,u=h;return g}(e,t,n);r.set(s,e.byteOffset)}}}],[{key:"STEP",get:function(){return 32e3}}])}(),o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==U.global?U.global:"undefined"!=typeof self?self:{};t="undefined"!=typeof window?window:void 0!==o?o:"undefined"!=typeof self?self:{};var u=t.BigInt||Number;u("0x1"),u("0x100"),u("0x10000"),u("0x1000000"),u("0x100000000"),u("0x10000000000"),u("0x1000000000000"),u("0x100000000000000"),u("0x10000000000000000"),function(){var e=new Uint16Array([65484]),t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);255===t[0]||t[0]}();var l=function(e){var t={};return Object.keys(e).forEach(function(n){var i,r=e[n];i=r,("function"===ArrayBuffer.isView?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer)?t[n]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:t[n]=r}),t};self.onmessage=function(e){var t=e.data,n=new Uint8Array(t.encrypted.bytes,t.encrypted.byteOffset,t.encrypted.byteLength),i=new Uint32Array(t.key.bytes,t.key.byteOffset,t.key.byteLength/4),r=new Uint32Array(t.iv.bytes,t.iv.byteOffset,t.iv.byteLength/4);new s(n,i,r,function(e,n){self.postMessage(l({source:t.source,decrypted:n}),[n.buffer])})}})),pv=Dm(hv),fv=function(e){var t=e.default?"main":"alternative";return e.characteristics&&e.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},mv=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},gv=function(e,t){t.activePlaylistLoader=e,e.load()},vv={AUDIO:function(e,t){return function(){var n=t.mediaTypes[e],i=t.excludePlaylist,r=n.activeTrack(),a=n.activeGroup(),s=(a.filter(function(e){return e.default})[0]||a[0]).id,o=n.tracks[s];if(r!==o){for(var u in rf.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[u].enabled=n.tracks[u]===o;n.onTrackChanged()}else i({error:{message:"Problem encountered loading the default audio track."}})}},SUBTITLES:function(e,t){return function(){var n=t.mediaTypes[e];rf.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");var i=n.activeTrack();i&&(i.mode="disabled"),n.onTrackChanged()}}},yv={AUDIO:function(e,t,n){if(t){var i=n.tech,r=n.requestOptions,a=n.segmentLoaders[e];t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,r),(!i.paused()||e.endList&&"none"!==i.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),r),i.paused()||a.load()}),t.on("error",vv[e](e,n))}},SUBTITLES:function(e,t,n){var i=n.tech,r=n.requestOptions,a=n.segmentLoaders[e],s=n.mediaTypes[e];t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!i.paused()||e.endList&&"none"!==i.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),r),i.paused()||a.load()}),t.on("error",vv[e](e,n))}},_v={AUDIO:function(e,t){var n=t.vhs,i=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.main.mediaGroups,o=t.mediaTypes[e],u=o.groups,l=o.tracks,c=o.logger_,d=t.mainPlaylistLoader,h=Vf(d.main);for(var p in s[e]&&0!==Object.keys(s[e]).length||(s[e]={main:{default:{default:!0}}},h&&(s[e].main.default.playlists=d.main.playlists)),s[e])for(var f in u[p]||(u[p]=[]),s[e][p]){var m=s[e][p][f],g=void 0;if(h?(c("AUDIO group '".concat(p,"' label '").concat(f,"' is a main playlist")),m.isMainPlaylist=!0,g=null):g="vhs-json"===i&&m.playlists?new sm(m.playlists[0],n,a):m.resolvedUri?new sm(m.resolvedUri,n,a):m.playlists&&"dash"===i?new Im(m.playlists[0],n,a,d):null,m=mf({id:f,playlistLoader:g},m),yv[e](e,m.playlistLoader,t),u[p].push(m),void 0===l[f]){var v=new rf.AudioTrack({id:f,kind:fv(m),enabled:!1,language:m.language,default:m.default,label:f});l[f]=v}}r.on("error",vv[e](e,t))},SUBTITLES:function(e,t){var n=t.tech,i=t.vhs,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.main.mediaGroups,u=t.mediaTypes[e],l=u.groups,c=u.tracks,d=t.mainPlaylistLoader;for(var h in o[e])for(var p in l[h]||(l[h]=[]),o[e][h])if(i.options_.useForcedSubtitles||!o[e][h][p].forced){var f=o[e][h][p],m=void 0;if("hls"===r)m=new sm(f.resolvedUri,i,s);else if("dash"===r){if(!f.playlists.filter(function(e){return e.excludeUntil!==1/0}).length)return;m=new Im(f.playlists[0],i,s,d)}else"vhs-json"===r&&(m=new sm(f.playlists?f.playlists[0]:f.resolvedUri,i,s));if(f=mf({id:p,playlistLoader:m},f),yv[e](e,f.playlistLoader,t),l[h].push(f),void 0===c[p]){var g=n.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;c[p]=g}}a.on("error",vv[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var n=t.tech,i=t.main.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in i[e])for(var u in a[o]||(a[o]=[]),i[e][o]){var l=i[e][o][u];if(/^(?:CC|SERVICE)/.test(l.instreamId)){var c=n.options_.vhs&&n.options_.vhs.captionServices||{},d={label:u,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(c[d.instreamId]&&(d=mf(d,c[d.instreamId])),void 0===d.default&&delete d.default,a[o].push(mf({id:u},l)),void 0===s[u]){var h=n.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d.default,language:d.language,label:d.label},!1).track;s[u]=h}}}}},bv=function(e,t){for(var n=0;n<e.length;n++){if(Ff(t,e[n]))return!0;if(e[n].playlists&&bv(e[n].playlists,t))return!0}return!1},Tv={AUDIO:function(e,t){return function(){var n=t.mediaTypes[e].tracks;for(var i in n)if(n[i].enabled)return n[i];return null}},SUBTITLES:function(e,t){return function(){var n=t.mediaTypes[e].tracks;for(var i in n)if("showing"===n[i].mode||"hidden"===n[i].mode)return n[i];return null}}},kv=function(e){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){_v[t](t,e)});var t=e.mediaTypes,n=e.mainPlaylistLoader,i=e.tech,r=e.vhs,a=e.segmentLoaders,s=a.AUDIO,o=a.main;["AUDIO","SUBTITLES"].forEach(function(n){t[n].activeGroup=function(e,t){return function(n){var i=t.mainPlaylistLoader,r=t.mediaTypes[e].groups,a=i.media();if(!a)return null;var s=null;a.attributes[e]&&(s=r[a.attributes[e]]);var o=Object.keys(r);if(!s)if("AUDIO"===e&&o.length>1&&Vf(t.main))for(var u=0;u<o.length;u++){var l=r[o[u]];if(bv(l,a)){s=l;break}}else r.main?s=r.main:1===o.length&&(s=r[o[0]]);return void 0===n?s:null!==n&&s&&s.filter(function(e){return e.id===n.id})[0]||null}}(n,e),t[n].activeTrack=Tv[n](n,e),t[n].onGroupChanged=function(e,t){return function(){var n=t.segmentLoaders,i=n[e],r=n.main,a=t.mediaTypes[e],s=a.activeTrack(),o=a.getActiveGroup(),u=a.activePlaylistLoader,l=a.lastGroup_;o&&l&&o.id===l.id||(a.lastGroup_=o,a.lastTrack_=s,mv(i,a),o&&!o.isMainPlaylist&&(o.playlistLoader?(i.resyncLoader(),gv(o.playlistLoader,a)):u&&r.resetEverything()))}}(n,e),t[n].onGroupChanging=function(e,t){return function(){var n=t.segmentLoaders[e];t.mediaTypes[e].lastGroup_=null,n.abort(),n.pause()}}(n,e),t[n].onTrackChanged=function(e,t){return function(){var n=t.mainPlaylistLoader,i=t.segmentLoaders,r=i[e],a=i.main,s=t.mediaTypes[e],o=s.activeTrack(),u=s.getActiveGroup(),l=s.activePlaylistLoader,c=s.lastTrack_;if((!c||!o||c.id!==o.id)&&(s.lastGroup_=u,s.lastTrack_=o,mv(r,s),u)){if(u.isMainPlaylist){if(!o||!c||o.id===c.id)return;var d=t.vhs.playlistController_,h=d.selectPlaylist();if(d.media()===h)return;return s.logger_("track change. Switching main audio from ".concat(c.id," to ").concat(o.id)),n.pause(),a.resetEverything(),void d.fastQualityChange_(h)}if("AUDIO"===e){if(!u.playlistLoader)return a.setAudio(!0),void a.resetEverything();r.setAudio(!0),a.setAudio(!1)}l!==u.playlistLoader?(r.track&&r.track(o),r.resetEverything(),gv(u.playlistLoader,s)):gv(u.playlistLoader,s)}}}(n,e),t[n].getActiveGroup=function(e,t){var n=t.mediaTypes;return function(){var t=n[e].activeTrack();return t?n[e].activeGroup(t):null}}(n,e)});var u=t.AUDIO.activeGroup();if(u){var l=(u.filter(function(e){return e.default})[0]||u[0]).id;t.AUDIO.tracks[l].enabled=!0,t.AUDIO.onGroupChanged(),t.AUDIO.onTrackChanged(),t.AUDIO.getActiveGroup().playlistLoader?(o.setAudio(!1),s.setAudio(!0)):o.setAudio(!0)}n.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(e){return t[e].onGroupChanged()})}),n.on("mediachanging",function(){["AUDIO","SUBTITLES"].forEach(function(e){return t[e].onGroupChanging()})});var c=function(){t.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};for(var d in i.audioTracks().addEventListener("change",c),i.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged),r.on("dispose",function(){i.audioTracks().removeEventListener("change",c),i.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)}),i.clearTracks("audio"),t.AUDIO.tracks)i.audioTracks().addTrack(t.AUDIO.tracks[d])},Sv=function(){return y(function e(){g(this,e),this.priority_=[],this.pathwayClones_=new Map},[{key:"version",get:function(){return this.version_},set:function(e){1===e&&(this.version_=e)}},{key:"ttl",get:function(){return this.ttl_},set:function(e){this.ttl_=e||300}},{key:"reloadUri",get:function(){return this.reloadUri_},set:function(e){e&&(this.reloadUri_=hf(this.reloadUri_,e))}},{key:"priority",get:function(){return this.priority_},set:function(e){e&&e.length&&(this.priority_=e)}},{key:"pathwayClones",get:function(){return this.pathwayClones_},set:function(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(function(e){return[e.ID,e]})))}}])}(),wv=function(){function e(t,n){var i;return g(this,e),(i=c(this,e)).currentPathway=null,i.defaultPathway=null,i.queryBeforeStart=!1,i.availablePathways_=new Set,i.steeringManifest=new Sv,i.proxyServerUrl_=null,i.manifestType_=null,i.ttlTimeout_=null,i.request_=null,i.currentPathwayClones=new Map,i.nextPathwayClones=new Map,i.excludedSteeringManifestURLs=new Set,i.logger_=ff("Content Steering"),i.xhr_=t,i.getBandwidth_=n,i}return f(e,rf.EventTarget),y(e,[{key:"assignTagProperties",value:function(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";var n=t.serverUri||t.serverURL;if(!n)return this.logger_("steering manifest URL is ".concat(n,", cannot request steering manifest.")),void this.trigger("error");n.startsWith("data:")?this.decodeDataUriManifest_(n.substring(n.indexOf(",")+1)):(this.steeringManifest.reloadUri=hf(e,n),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering"))}},{key:"requestSteeringManifest",value:function(e){var t=this,n=this.steeringManifest.reloadUri;if(n){var i=e?n:this.getRequestURI(n);if(!i)return this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),void this.dispose();var r={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:r}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},function(e,n){if(e){if(410===n.status)return t.logger_("manifest request 410 ".concat(e,".")),t.logger_("There will be no more content steering requests to ".concat(i," this session.")),void t.excludedSteeringManifestURLs.add(i);if(429===n.status){var a=n.responseHeaders["retry-after"];return t.logger_("manifest request 429 ".concat(e,".")),t.logger_("content steering will retry in ".concat(a," seconds.")),void t.startTTLTimeout_(parseInt(a,10))}return t.logger_("manifest failed to load ".concat(e,".")),void t.startTTLTimeout_()}var s;t.trigger({type:"contentsteeringloadcomplete",metadata:r});try{s=JSON.parse(t.request_.responseText)}catch(l){var o={errorType:rf.Error.StreamingContentSteeringParserError,error:l};t.trigger({type:"error",metadata:o})}t.assignSteeringProperties_(s);var u={contentSteeringInfo:r.contentSteeringInfo,contentSteeringManifest:{version:t.steeringManifest.version,reloadUri:t.steeringManifest.reloadUri,priority:t.steeringManifest.priority}};t.trigger({type:"contentsteeringparsed",metadata:u}),t.startTTLTimeout_()})}}},{key:"setProxyServerUrl_",value:function(e){var t=new wn.URL(e),n=new wn.URL(this.proxyServerUrl_);return n.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(n.toString())}},{key:"decodeDataUriManifest_",value:function(e){var t=JSON.parse(wn.atob(e));this.assignSteeringProperties_(t)}},{key:"setSteeringParams_",value:function(e){var t=new wn.URL(e),n=this.getPathway(),i=this.getBandwidth_();if(n){var r="_".concat(this.manifestType_,"_pathway");t.searchParams.set(r,n)}if(i){var a="_".concat(this.manifestType_,"_throughput");t.searchParams.set(a,i)}return t.toString()}},{key:"assignSteeringProperties_",value:function(e){var t=this;if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version)return this.logger_("manifest version is ".concat(e.VERSION,", which is not supported.")),void this.trigger("error");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());var n=function(e){var n,i=_(e);try{for(i.s();!(n=i.n()).done;){var r=n.value;if(t.availablePathways_.has(r))return r}}catch(a){i.e(a)}finally{i.f()}return b(t.availablePathways_)[0]}(this.steeringManifest.priority);this.currentPathway!==n&&(this.currentPathway=n,this.trigger("content-steering"))}},{key:"getPathway",value:function(){return this.currentPathway||this.defaultPathway}},{key:"getRequestURI",value:function(e){var t=this;if(!e)return null;var n=function(e){return t.excludedSteeringManifestURLs.has(e)};if(this.proxyServerUrl_){var i=this.setProxyServerUrl_(e);if(!n(i))return i}var r=this.setSteeringParams_(e);return n(r)?null:r}},{key:"startTTLTimeout_",value:function(){var e=this,t=1e3*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.steeringManifest.ttl);this.ttlTimeout_=wn.setTimeout(function(){e.requestSteeringManifest()},t)}},{key:"clearTTLTimeout_",value:function(){wn.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}},{key:"abort",value:function(){this.request_&&this.request_.abort(),this.request_=null}},{key:"dispose",value:function(){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 Sv}},{key:"addAvailablePathway",value:function(e){e&&this.availablePathways_.add(e)}},{key:"clearAvailablePathways",value:function(){this.availablePathways_.clear()}},{key:"excludePathway",value:function(e){return this.availablePathways_.delete(e)}},{key:"didDASHTagChange",value:function(e,t){return!t&&this.steeringManifest.reloadUri||t&&(hf(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}},{key:"getAvailablePathways",value:function(){return this.availablePathways_}}])}(),Ev=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Cv=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]},Av=function(){function e(t){var n,i,r,a;g(this,e),(n=c(this,e)).fastQualityChange_=(i=n.fastQualityChange_.bind(n),r=100,a=null,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];clearTimeout(a),a=setTimeout(function(){i.apply(null,t)},r)});var s=t.src,o=t.withCredentials,u=t.tech,l=t.bandwidth,d=t.externVhs,h=t.useCueTags,p=t.playlistExclusionDuration,f=t.enableLowInitialPlaylist,m=t.sourceType,v=t.cacheEncryptionKeys,y=t.bufferBasedABR,_=t.leastPixelDiffSelector,b=t.captionServices,T=t.experimentalUseMMS;if(!s)throw new Error("A non-empty playlist URL or JSON manifest string is required");var k,S=t.maxPlaylistRetries;null==S&&(S=1/0),Og=d,n.bufferBasedABR=Boolean(y),n.leastPixelDiffSelector=Boolean(_),n.withCredentials=o,n.tech_=u,n.vhs_=u.vhs,n.player_=t.player_,n.sourceType_=m,n.useCueTags_=h,n.playlistExclusionDuration=p,n.maxPlaylistRetries=S,n.enableLowInitialPlaylist=f,n.usingManagedMediaSource_=!1,n.useCueTags_&&(n.cueTagsTrack_=n.tech_.addTextTrack("metadata","ad-cues"),n.cueTagsTrack_.inBandMetadataTrackDispatchType=""),n.requestOptions_={withCredentials:o,maxPlaylistRetries:S,timeout:null},n.on("error",n.pauseLoading),n.mediaTypes_=(k={},["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(e){k[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Rg,activeTrack:Rg,getActiveGroup:Rg,onGroupChanged:Rg,onTrackChanged:Rg,lastTrack_:null,logger_:ff("MediaGroups[".concat(e,"]"))}}),k),T&&wn.ManagedMediaSource?(n.tech_.el_.disableRemotePlayback=!0,n.mediaSource=new wn.ManagedMediaSource,n.usingManagedMediaSource_=!0,rf.log("Using ManagedMediaSource")):wn.MediaSource&&(n.mediaSource=new wn.MediaSource),n.handleDurationChange_=n.handleDurationChange_.bind(n),n.handleSourceOpen_=n.handleSourceOpen_.bind(n),n.handleSourceEnded_=n.handleSourceEnded_.bind(n),n.load=n.load.bind(n),n.pause=n.pause.bind(n),n.mediaSource.addEventListener("durationchange",n.handleDurationChange_),n.mediaSource.addEventListener("sourceopen",n.handleSourceOpen_),n.mediaSource.addEventListener("sourceended",n.handleSourceEnded_),n.mediaSource.addEventListener("startstreaming",n.load),n.mediaSource.addEventListener("endstreaming",n.pause),n.seekable_=gf(),n.hasPlayed_=!1,n.syncController_=new cv(t),n.segmentMetadataTrack_=u.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,n.decrypter_=new pv,n.sourceUpdater_=new Zg(n.mediaSource),n.inbandTextTracks_={},n.timelineChangeController_=new dv,n.keyStatusMap_=new Map;var w={vhs:n.vhs_,parse708captions:t.parse708captions,useDtsForTimestampOffset:t.useDtsForTimestampOffset,captionServices:b,mediaSource:n.mediaSource,currentTime:n.tech_.currentTime.bind(n.tech_),seekable:function(){return n.seekable()},seeking:function(){return n.tech_.seeking()},duration:function(){return n.duration()},hasPlayed:function(){return n.hasPlayed_},goalBufferLength:function(){return n.goalBufferLength()},bandwidth:l,syncController:n.syncController_,decrypter:n.decrypter_,sourceType:n.sourceType_,inbandTextTracks:n.inbandTextTracks_,cacheEncryptionKeys:v,sourceUpdater:n.sourceUpdater_,timelineChangeController:n.timelineChangeController_,exactManifestTimings:t.exactManifestTimings,addMetadataToTextTrack:n.addMetadataToTextTrack.bind(n)};n.mainPlaylistLoader_="dash"===n.sourceType_?new Im(s,n.vhs_,mf(n.requestOptions_,{addMetadataToTextTrack:n.addMetadataToTextTrack.bind(n)})):new sm(s,n.vhs_,mf(n.requestOptions_,{addDateRangesToTextTrack:n.addDateRangesToTextTrack_.bind(n)})),n.setupMainPlaylistLoaderListeners_(),n.mainSegmentLoader_=new Pg(mf(w,{segmentMetadataTrack:n.segmentMetadataTrack_,loaderType:"main"}),t),n.audioSegmentLoader_=new Pg(mf(w,{loaderType:"audio"}),t),n.subtitleSegmentLoader_=new iv(mf(w,{loaderType:"vtt",featuresNativeTextTracks:n.tech_.featuresNativeTextTracks,loadVttJs:function(){return new Promise(function(e,t){function n(){u.off("vttjserror",i),e()}function i(){u.off("vttjsloaded",n),t()}u.one("vttjsloaded",n),u.one("vttjserror",i),u.addWebVttScript_()})}}),t);n.contentSteeringController_=new wv(n.vhs_.xhr,function(){return n.mainSegmentLoader_.bandwidth}),n.setupSegmentLoaderListeners_(),n.bufferBasedABR&&(n.mainPlaylistLoader_.one("loadedplaylist",function(){return n.startABRTimer_()}),n.tech_.on("pause",function(){return n.stopABRTimer_()}),n.tech_.on("play",function(){return n.startABRTimer_()})),Ev.forEach(function(e){n[e+"_"]=Cv.bind(n,e)}),n.logger_=ff("pc"),n.triggeredFmp4Usage=!1,"none"===n.tech_.preload()?(n.loadOnPlay_=function(){n.loadOnPlay_=null,n.mainPlaylistLoader_.load()},n.tech_.one("play",n.loadOnPlay_)):n.mainPlaylistLoader_.load(),n.timeToLoadedData__=-1,n.mainAppendsToLoadedData__=-1,n.audioAppendsToLoadedData__=-1;var E="none"===n.tech_.preload()?"play":"loadstart";return n.tech_.one(E,function(){var e=Date.now();n.tech_.one("loadeddata",function(){n.timeToLoadedData__=Date.now()-e,n.mainAppendsToLoadedData__=n.mainSegmentLoader_.mediaAppends,n.audioAppendsToLoadedData__=n.audioSegmentLoader_.mediaAppends})}),n}return f(e,rf.EventTarget),y(e,[{key:"mainAppendsToLoadedData_",value:function(){return this.mainAppendsToLoadedData__}},{key:"audioAppendsToLoadedData_",value:function(){return this.audioAppendsToLoadedData__}},{key:"appendsToLoadedData_",value:function(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t}},{key:"timeToLoadedData_",value:function(){return this.timeToLoadedData__}},{key:"checkABR_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"abr",t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}},{key:"switchMedia_",value:function(e,t,n){var i=this.media(),r=i&&(i.id||i.uri),a=e&&(e.id||e.uri);if(r&&r!==a){this.logger_("switch media ".concat(r," -> ").concat(a," from ").concat(t));var s={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:s}),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-".concat(t)})}this.mainPlaylistLoader_.media(e,n)}},{key:"switchMediaForDASHContentSteering_",value:function(){var e=this;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){var n=e.mediaTypes_[t],i=n?n.activeGroup():null,r=e.contentSteeringController_.getPathway();if(i&&r){var a=(i.length?i[0].playlists:i.playlists).filter(function(e){return e.attributes.serviceLocation===r});a.length&&e.mediaTypes_[t].activePlaylistLoader.media(a[0])}})}},{key:"startABRTimer_",value:function(){var e=this;this.stopABRTimer_(),this.abrTimer_=wn.setInterval(function(){return e.checkABR_()},250)}},{key:"stopABRTimer_",value:function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(wn.clearInterval(this.abrTimer_),this.abrTimer_=null)}},{key:"getAudioTrackPlaylists_",value:function(){var e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var n,i=e.mediaGroups.AUDIO,r=Object.keys(i);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{var a=i.main||r.length&&i[r[0]];for(var s in a)if(a[s].default){n={label:s};break}}if(!n)return t;var o=[];for(var u in i)if(i[u][n.label]){var l=i[u][n.label];if(l.playlists&&l.playlists.length)o.push.apply(o,l.playlists);else if(l.uri)o.push(l);else if(e.playlists.length)for(var c=0;c<e.playlists.length;c++){var d=e.playlists[c];d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===u&&o.push(d)}}return o.length?o:t}},{key:"setupMainPlaylistLoaderListeners_",value:function(){var e=this;this.mainPlaylistLoader_.on("loadedmetadata",function(){var t=e.mainPlaylistLoader_.media(),n=1.5*t.targetDuration*1e3;jf(e.mainPlaylistLoader_.main,e.mainPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=n,t.endList&&"none"!==e.tech_.preload()&&(e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.mainSegmentLoader_.load()),kv({sourceType:e.sourceType_,segmentLoaders:{AUDIO:e.audioSegmentLoader_,SUBTITLES:e.subtitleSegmentLoader_,main:e.mainSegmentLoader_},tech:e.tech_,requestOptions:e.requestOptions_,mainPlaylistLoader:e.mainPlaylistLoader_,vhs:e.vhs_,main:e.main(),mediaTypes:e.mediaTypes_,excludePlaylist:e.excludePlaylist.bind(e)}),e.triggerPresenceUsage_(e.main(),t),e.setupFirstPlay(),!e.mediaTypes_.AUDIO.activePlaylistLoader||e.mediaTypes_.AUDIO.activePlaylistLoader.media()?e.trigger("selectedinitialmedia"):e.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",function(){e.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",function(){e.loadOnPlay_&&e.tech_.off("play",e.loadOnPlay_);var t=e.mainPlaylistLoader_.media();if(!t){var n;if(e.attachContentSteeringListeners_(),e.initContentSteeringController_(),e.excludeUnsupportedVariants_(),e.enableLowInitialPlaylist&&(n=e.selectInitialPlaylist()),n||(n=e.selectPlaylist()),!n||!e.shouldSwitchToMedia_(n))return;if(e.initialMedia_=n,e.switchMedia_(e.initialMedia_,"initial"),!("vhs-json"===e.sourceType_&&e.initialMedia_.segments))return;t=e.initialMedia_}e.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",function(){var t=e.mainPlaylistLoader_.error;e.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",function(){e.mainSegmentLoader_.abort(),e.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",function(){var t=e.mainPlaylistLoader_.media(),n=1.5*t.targetDuration*1e3;jf(e.mainPlaylistLoader_.main,e.mainPlaylistLoader_.media())?e.requestOptions_.timeout=0:e.requestOptions_.timeout=n,"dash"===e.sourceType_&&e.mainPlaylistLoader_.isPaused&&e.mainPlaylistLoader_.load(),e.mainSegmentLoader_.pause(),e.mainSegmentLoader_.playlist(t,e.requestOptions_),e.waitingForFastQualityPlaylistReceived_?e.runFastQualitySwitch_():e.mainSegmentLoader_.load(),e.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",function(){var t=e.mainPlaylistLoader_.media();"playlist-unchanged"!==t.lastExcludeReason_&&(e.stuckAtPlaylistEnd_(t)&&(e.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),e.tech_.trigger("playliststuck")))}),this.mainPlaylistLoader_.on("renditiondisabled",function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",function(){e.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})});["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(function(t){e.mainPlaylistLoader_.on(t,function(t){e.player_.trigger($({},t))})})}},{key:"handleUpdatedMediaPlaylist",value:function(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())}},{key:"triggerPresenceUsage_",value:function(e,t){var n=e.mediaGroups||{},i=!0,r=Object.keys(n.AUDIO);for(var a in n.AUDIO)for(var s in n.AUDIO[a]){n.AUDIO[a][s].uri||(i=!1)}i&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(n.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Og.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(n.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}},{key:"shouldSwitchToMedia_",value:function(e){var t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,n=this.tech_.currentTime(),i=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return function(e){var t=e.currentPlaylist,n=e.buffered,i=e.currentTime,r=e.nextPlaylist,a=e.bufferLowWaterLine,s=e.bufferHighWaterLine,o=e.duration,u=e.bufferBasedABR,l=e.log;if(!r)return rf.log.warn("We received no playlist to switch to. Please check your stream."),!1;var c="allowing switch ".concat(t&&t.id||"null"," -> ").concat(r.id);if(!t)return l("".concat(c," as current playlist is not set")),!0;if(r.id===t.id)return!1;var d=Boolean(bf(n,i).length);if(!t.endList)return d||"number"!=typeof t.partTargetDuration?(l("".concat(c," as current playlist is live")),!0):(l("not ".concat(c," as current playlist is live llhls, but currentTime isn't in buffered.")),!1);var h=Ef(n,i),p=u?xm.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:xm.MAX_BUFFER_LOW_WATER_LINE;if(o<p)return l("".concat(c," as duration < max low water line (").concat(o," < ").concat(p,")")),!0;var f=r.attributes.BANDWIDTH,m=t.attributes.BANDWIDTH;if(f<m&&(!u||h<s)){var g="".concat(c," as next bandwidth < current bandwidth (").concat(f," < ").concat(m,")");return u&&(g+=" and forwardBuffer < bufferHighWaterLine (".concat(h," < ").concat(s,")")),l(g),!0}if((!u||f>m)&&h>=a){var v="".concat(c," as forwardBuffer >= bufferLowWaterLine (").concat(h," >= ").concat(a,")");return u&&(v+=" and next bandwidth > current bandwidth (".concat(f," > ").concat(m,")")),l(v),!0}return l("not ".concat(c," as no switching criteria met")),!1}({buffered:this.tech_.buffered(),currentTime:n,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:i,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}},{key:"setupSegmentLoaderListeners_",value:function(){var e=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){e.checkABR_("bandwidthupdate"),e.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",function(){e.bufferBasedABR&&e.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",function(){e.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){var t=e.mainSegmentLoader_.error();e.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainSegmentLoader_.on("appenderror",function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",function(){e.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")}),this.mainSegmentLoader_.on("ended",function(){e.logger_("main segment loader ended"),e.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",function(){var t=e.audioSegmentLoader_.pendingSegment_;if(t&&t.segment&&t.segment.syncInfo){var n=t.segment.syncInfo.end+.01;e.tech_.setCurrentTime(n)}}),this.timelineChangeController_.on("fixBadTimelineChange",function(){e.logger_("Fix bad timeline change. Restarting al segment loaders..."),e.mainSegmentLoader_.pause(),e.mainSegmentLoader_.resetEverything(),e.mediaTypes_.AUDIO.activePlaylistLoader&&(e.audioSegmentLoader_.pause(),e.audioSegmentLoader_.resetEverything()),e.mediaTypes_.SUBTITLES.activePlaylistLoader&&(e.subtitleSegmentLoader_.pause(),e.subtitleSegmentLoader_.resetEverything()),e.load()}),this.mainSegmentLoader_.on("earlyabort",function(t){e.bufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:10}))});var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()});["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(function(t){e.mainSegmentLoader_.on(t,function(t){e.player_.trigger($({},t))}),e.audioSegmentLoader_.on(t,function(t){e.player_.trigger($({},t))}),e.subtitleSegmentLoader_.on(t,function(t){e.player_.trigger($({},t))})})}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}},{key:"pause",value:function(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}},{key:"fastQualityChange_",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.selectPlaylist();e&&e===this.mainPlaylistLoader_.media()?this.logger_("skipping fastQualityChange because new media is same as old"):(this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0)}},{key:"runFastQualitySwitch_",value:function(){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()}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}}},{key:"setupFirstPlay",value:function(){var e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){var t=this.seekable();if(!t.length)return!1;var n=t.end(0),i=n;if(e.start){var r=e.start.timeOffset;i=r<0?Math.max(n+r,t.start(0)):Math.min(n,r)}this.trigger("firstplay"),this.tech_.setCurrentTime(i)}return this.hasPlayed_=!0,this.load(),!0}},{key:"handleSourceOpen_",value:function(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){var e=this.tech_.play();void 0!==e&&"function"==typeof e.then&&e.then(null,function(e){})}this.trigger("sourceopen")}},{key:"handleSourceEnded_",value:function(){if(this.inbandTextTracks_.metadataTrack_){var e=this.inbandTextTracks_.metadataTrack_.cues;if(e&&e.length){var t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}}}},{key:"handleDurationChange_",value:function(){this.tech_.trigger("durationchange")}},{key:"onEndOfStream",value:function(){var e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){var t=this.mainSegmentLoader_.getCurrentMediaInfo_();e=!t||t.hasVideo?e&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}},{key:"stuckAtPlaylistEnd_",value:function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;var n=Og.Playlist.playlistEnd(e,t),i=this.tech_.currentTime(),r=this.tech_.buffered();if(!r.length)return n-i<=yf;var a=r.end(r.length-1);return a-i<=yf&&n-a<=yf}},{key:"excludePlaylist",value:function(e){var t=this,n=e.playlistToExclude,i=void 0===n?this.mainPlaylistLoader_.media():n,r=e.error,a=void 0===r?{}:r,s=e.playlistExclusionDuration;if(i=i||this.mainPlaylistLoader_.media(),s=s||a.playlistExclusionDuration||this.playlistExclusionDuration,!i)return this.error=a,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));i.playlistErrors_++;var o,u=this.mainPlaylistLoader_.main.playlists,l=u.filter(Mf),c=1===l.length&&l[0]===i;if(1===u.length&&s!==1/0)return rf.log.warn("Problem encountered with playlist ".concat(i.id,". ")+"Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(c);if(c){if(this.main().contentSteering){var d=this.pathwayAttribute_(i),h=1e3*this.contentSteeringController_.steeringManifest.ttl;return this.contentSteeringController_.excludePathway(d),this.excludeThenChangePathway_(),void setTimeout(function(){t.contentSteeringController_.addAvailablePathway(d)},h)}var p=!1;u.forEach(function(e){if(e!==i){var t=e.excludeUntil;void 0!==t&&t!==1/0&&(p=!0,delete e.excludeUntil)}}),p&&(rf.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}o=i.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*s,i.excludeUntil=o,a.reason&&(i.lastExcludeReason_=a.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});var f=this.selectPlaylist();if(!f)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var m=a.internal?this.logger_:rf.log.warn,g=a.message?" "+a.message:"";m("".concat(a.internal?"Internal problem":"Problem"," encountered with playlist ").concat(i.id,".")+"".concat(g," Switching to playlist ").concat(f.id,".")),f.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),f.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var v=f.targetDuration/2*1e3||5e3,y="number"==typeof f.lastRequest&&Date.now()-f.lastRequest<=v;return this.switchMedia_(f,"exclude",c||y)}},{key:"pauseLoading",value:function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}},{key:"delegateLoaders_",value:function(e,t){var n=this,i=[],r="all"===e;(r||"main"===e)&&i.push(this.mainPlaylistLoader_);var a=[];(r||"audio"===e)&&a.push("AUDIO"),(r||"subtitle"===e)&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach(function(e){var t=n.mediaTypes_[e]&&n.mediaTypes_[e].activePlaylistLoader;t&&i.push(t)}),["main","audio","subtitle"].forEach(function(t){var r=n["".concat(t,"SegmentLoader_")];!r||e!==t&&"all"!==e||i.push(r)}),i.forEach(function(e){return t.forEach(function(t){"function"==typeof e[t]&&e[t]()})})}},{key:"setCurrentTime",value:function(e){var t=bf(this.tech_.buffered(),e);return this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media()&&this.mainPlaylistLoader_.media().segments?t&&t.length?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()),void this.load()):0}},{key:"duration",value:function(){if(!this.mainPlaylistLoader_)return 0;var e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Og.Playlist.duration(e):1/0:0}},{key:"seekable",value:function(){return this.seekable_}},{key:"getSeekableRange_",value:function(e,t){var n=e.media();if(!n)return null;var i=this.syncController_.getMediaSequenceSync(t);if(i&&i.isReliable){var r=i.start,a=i.end;if(!isFinite(r)||!isFinite(a))return null;var s=Og.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,n),o=Math.max(0,a-s);return o<r?null:gf([[r,o]])}var u=this.syncController_.getExpiredTime(n,this.duration());if(null===u)return null;var l=Og.Playlist.seekable(n,u,Og.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,n));return l.length?l:null}},{key:"computeFinalSeekable_",value:function(e,t){if(!t)return e;var n=e.start(0),i=e.end(0),r=t.start(0),a=t.end(0);return r>i||n>a?e:gf([[Math.max(n,r),Math.min(i,a)]])}},{key:"onSyncInfoUpdate_",value:function(){if(this.mainPlaylistLoader_){var e,t=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(t)if(!this.mediaTypes_.AUDIO.activePlaylistLoader||(e=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"))){var n=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(t,e),this.seekable_&&!(n&&n.length&&this.seekable_.length&&n.start(0)===this.seekable_.start(0)&&n.end(0)===this.seekable_.end(0))){this.logger_("seekable updated [".concat(kf(this.seekable_),"]"));var i={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:i}),this.tech_.trigger("seekablechanged")}}}}},{key:"updateDuration",value:function(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){var t=this.seekable();if(!t.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<t.end(t.length-1))&&this.sourceUpdater_.setDuration(t.end(t.length-1))}else{var n=this.tech_.buffered(),i=Og.Playlist.duration(this.mainPlaylistLoader_.media());n.length>0&&(i=Math.max(i,n.end(n.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}}},{key:"dispose",value:function(){var e=this;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(function(t){var n=e.mediaTypes_[t].groups;for(var i in n)n[i].forEach(function(e){e.playlistLoader&&e.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()}},{key:"main",value:function(){return this.mainPlaylistLoader_.main}},{key:"media",value:function(){return this.mainPlaylistLoader_.media()||this.initialMedia_}},{key:"areMediaTypesKnown_",value:function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),n=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!n)}},{key:"getCodecsOrExclude_",value:function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},n=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();t.video=t.main;var i=lg(this.main(),n),r={},a=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(r.video=i.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(r.video+=",".concat(i.audio||t.main.audioCodec||Tr)),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||a)&&(r.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||Tr,t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),r.audio||r.video){var s,o={};if(["video","audio"].forEach(function(n){if(r.hasOwnProperty(n)&&(a=t[n].isFmp4,u=r[n],!(a?_r(u,e.usingManagedMediaSource_):br(u)))){var i=t[n].isFmp4?"browser":"muxer";o[i]=o[i]||[],o[i].push(r[n]),"audio"===n&&(s=i)}var a,u}),a&&s&&n.attributes.AUDIO){var u=n.attributes.AUDIO;this.main().playlists.forEach(function(e){(e.attributes&&e.attributes.AUDIO)===u&&e!==n&&(e.excludeUntil=1/0)}),this.logger_("excluding audio group ".concat(u," as ").concat(s,' does not support codec(s): "').concat(r.audio,'"'))}if(!Object.keys(o).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var l=[];if(["video","audio"].forEach(function(t){var n=(gr(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,i=(gr(r[t]||"")[0]||{}).type;n&&i&&n.toLowerCase()!==i.toLowerCase()&&l.push('"'.concat(e.sourceUpdater_.codecs[t],'" -> "').concat(r[t],'"'))}),l.length)return void this.excludePlaylist({playlistToExclude:n,error:{message:"Codec switching not supported: ".concat(l.join(", "),"."),internal:!0},playlistExclusionDuration:1/0})}return r}var c=Object.keys(o).reduce(function(e,t){return e&&(e+=", "),e+="".concat(t,' does not support codec(s): "').concat(o[t].join(","),'"')},"")+".";this.excludePlaylist({playlistToExclude:n,error:{internal:!0,message:c},playlistExclusionDuration:1/0})}else this.excludePlaylist({playlistToExclude:n,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0})}},{key:"tryToCreateSourceBuffers_",value:function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}}},{key:"excludeUnsupportedVariants_",value:function(){var e=this,t=this.main().playlists,n=[];Object.keys(t).forEach(function(i){var r=t[i];if(-1===n.indexOf(r.id)){n.push(r.id);var a=lg(e.main,r),s=[];!a.audio||br(a.audio)||_r(a.audio,e.usingManagedMediaSource_)||s.push("audio codec ".concat(a.audio)),!a.video||br(a.video)||_r(a.video,e.usingManagedMediaSource_)||s.push("video codec ".concat(a.video)),a.text&&"stpp.ttml.im1t"===a.text&&s.push("text codec ".concat(a.text)),s.length&&(r.excludeUntil=1/0,e.logger_("excluding ".concat(r.id," for unsupported: ").concat(s.join(", "))))}})}},{key:"excludeIncompatibleVariants_",value:function(e){var t=this,n=[],i=this.main().playlists,r=og(gr(e)),a=ug(r),s=r.video&&gr(r.video)[0]||null,o=r.audio&&gr(r.audio)[0]||null;Object.keys(i).forEach(function(e){var r=i[e];if(-1===n.indexOf(r.id)&&r.excludeUntil!==1/0){n.push(r.id);var u=[],l=lg(t.mainPlaylistLoader_.main,r),c=ug(l);if(l.audio||l.video){if(c!==a&&u.push('codec count "'.concat(c,'" !== "').concat(a,'"')),!t.sourceUpdater_.canChangeType()){var d=l.video&&gr(l.video)[0]||null,h=l.audio&&gr(l.audio)[0]||null;d&&s&&d.type.toLowerCase()!==s.type.toLowerCase()&&u.push('video codec "'.concat(d.type,'" !== "').concat(s.type,'"')),h&&o&&h.type.toLowerCase()!==o.type.toLowerCase()&&u.push('audio codec "'.concat(h.type,'" !== "').concat(o.type,'"'))}u.length&&(r.excludeUntil=1/0,t.logger_("excluding ".concat(r.id,": ").concat(u.join(" && "))))}}})}},{key:"updateAdCues_",value:function(e){var t=0,n=this.seekable();n.length&&(t=n.start(0)),function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(e.segments)for(var i,r=n,a=0;a<e.segments.length;a++){var s=e.segments[a];if(i||(i=rv(t,r+s.duration/2)),i){if("cueIn"in s){i.endTime=r,i.adEndTime=r,r+=s.duration,i=null;continue}if(r<i.endTime){r+=s.duration;continue}i.endTime+=s.duration}else if("cueOut"in s&&((i=new wn.VTTCue(r,r+s.duration,s.cueOut)).adStartTime=r,i.adEndTime=r+parseFloat(s.cueOut),t.addCue(i)),"cueOutCont"in s){var o=S(s.cueOutCont.split("/").map(parseFloat),2),u=o[0],l=o[1];(i=new wn.VTTCue(r,r+s.duration,"")).adStartTime=r-u,i.adEndTime=i.adStartTime+l,t.addCue(i)}r+=s.duration}}(e,this.cueTagsTrack_,t)}},{key:"goalBufferLength",value:function(){var e=this.tech_.currentTime(),t=xm.GOAL_BUFFER_LENGTH,n=xm.GOAL_BUFFER_LENGTH_RATE,i=Math.max(t,xm.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*n,i)}},{key:"bufferLowWaterLine",value:function(){var e=this.tech_.currentTime(),t=xm.BUFFER_LOW_WATER_LINE,n=xm.BUFFER_LOW_WATER_LINE_RATE,i=Math.max(t,xm.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,xm.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*n,this.bufferBasedABR?r:i)}},{key:"bufferHighWaterLine",value:function(){return xm.BUFFER_HIGH_WATER_LINE}},{key:"addDateRangesToTextTrack_",value:function(e){Tg(this.inbandTextTracks_,"com.apple.streaming",this.tech_),function(e){var t=e.inbandTextTracks,n=e.dateRanges,i=t.metadataTrack_;if(i){var r=wn.WebKitDataCue||wn.VTTCue;n.forEach(function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var a=n[t];if(!bg.has(a)){var s=new r(e.startTime,e.endTime,"");s.id=e.id,s.type="com.apple.quicktime.HLS",s.value={key:_g[a],data:e[a]},"scte35Out"!==a&&"scte35In"!==a||(s.value.data=new Uint8Array(s.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(s)}}e.processDateRange()})}}({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}},{key:"addMetadataToTextTrack",value:function(e,t,n){var i=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Tg(this.inbandTextTracks_,e,this.tech_),yg({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:i,videoDuration:n})}},{key:"pathwayAttribute_",value:function(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}},{key:"initContentSteeringController_",value:function(){var e=this,t=this.main();if(t.contentSteering){var n,i=_(t.playlists);try{for(i.s();!(n=i.n()).done;){var r=n.value;this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(r))}}catch(a){i.e(a)}finally{i.f()}this.contentSteeringController_.assignTagProperties(t.uri,t.contentSteering),this.contentSteeringController_.queryBeforeStart?this.contentSteeringController_.requestSteeringManifest(!0):this.tech_.one("canplay",function(){e.contentSteeringController_.requestSteeringManifest()})}}},{key:"resetContentSteeringController_",value:function(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}},{key:"attachContentSteeringListeners_",value:function(){var e=this;this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this));["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(function(t){e.contentSteeringController_.on(t,function(t){e.trigger($({},t))})}),"dash"===this.sourceType_&&this.mainPlaylistLoader_.on("loadedplaylist",function(){var t=e.main();(e.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||function(){var n,i=e.contentSteeringController_.getAvailablePathways(),r=[],a=_(t.playlists);try{for(a.s();!(n=a.n()).done;){var s=n.value.attributes.serviceLocation;if(s&&(r.push(s),!i.has(s)))return!0}}catch(o){a.e(o)}finally{a.f()}return!(r.length||!i.size)}())&&e.resetContentSteeringController_()})}},{key:"excludeThenChangePathway_",value:function(){var e=this,t=this.contentSteeringController_.getPathway();if(t){this.handlePathwayClones_();var n=this.main().playlists,i=new Set,r=!1;Object.keys(n).forEach(function(a){var s=n[a],o=e.pathwayAttribute_(s),u=o&&t!==o;s.excludeUntil===1/0&&"content-steering"===s.lastExcludeReason_&&!u&&(delete s.excludeUntil,delete s.lastExcludeReason_,r=!0);var l=!s.excludeUntil&&s.excludeUntil!==1/0;!i.has(s.id)&&u&&l&&(i.add(s.id),s.excludeUntil=1/0,s.lastExcludeReason_="content-steering",e.logger_("excluding ".concat(s.id," for ").concat(s.lastExcludeReason_)))}),"DASH"===this.contentSteeringController_.manifestType_&&Object.keys(this.mediaTypes_).forEach(function(n){var i=e.mediaTypes_[n];if(i.activePlaylistLoader){var a=i.activePlaylistLoader.media_;a&&a.attributes.serviceLocation!==t&&(r=!0)}}),r&&this.changeSegmentPathway_()}}},{key:"handlePathwayClones_",value:function(){var e=this,t=this.main().playlists,n=this.contentSteeringController_.currentPathwayClones,i=this.contentSteeringController_.nextPathwayClones;if(n&&n.size||i&&i.size){var r,a=_(n.entries());try{for(a.s();!(r=a.n()).done;){var s=S(r.value,2),o=s[0],u=s[1];i.get(o)||(this.mainPlaylistLoader_.updateOrDeleteClone(u),this.contentSteeringController_.excludePathway(o))}}catch(h){a.e(h)}finally{a.f()}var l,c=_(i.entries());try{var d=function(){var i=S(l.value,2),r=i[0],a=i[1],s=n.get(r);return s?e.equalPathwayClones_(s,a)?0:(e.mainPlaylistLoader_.updateOrDeleteClone(a,!0),void e.contentSteeringController_.addAvailablePathway(r)):(t.filter(function(e){return e.attributes["PATHWAY-ID"]===a["BASE-ID"]}).forEach(function(t){e.mainPlaylistLoader_.addClonePathway(a,t)}),e.contentSteeringController_.addAvailablePathway(r),0)};for(c.s();!(l=c.n()).done;)d()}catch(h){c.e(h)}finally{c.f()}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify(b(i))))}}},{key:"equalPathwayClones_",value:function(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;var n=e["URI-REPLACEMENT"].PARAMS,i=t["URI-REPLACEMENT"].PARAMS;for(var r in n)if(n[r]!==i[r])return!1;for(var a in i)if(n[a]!==i[a])return!1;return!0}},{key:"changeSegmentPathway_",value:function(){var e=this.selectPlaylist();this.pauseLoading(),"DASH"===this.contentSteeringController_.manifestType_&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}},{key:"excludeNonUsablePlaylistsByKeyId_",value:function(){var e=this;if(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.main){var t=0,n="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(function(i){var r=e.mainPlaylistLoader_.getKeyIdSet(i);r&&r.size&&r.forEach(function(r){var a="usable",s=e.keyStatusMap_.has(r)&&e.keyStatusMap_.get(r)===a,o=i.lastExcludeReason_===n&&i.excludeUntil===1/0;s?s&&o&&(delete i.excludeUntil,delete i.lastExcludeReason_,e.logger_("enabling playlist ".concat(i.id," because key ID ").concat(r," is ").concat(a))):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==n&&(i.excludeUntil=1/0,i.lastExcludeReason_=n,e.logger_("excluding playlist ".concat(i.id," because the key ID ").concat(r," doesn't exist in the keyStatusMap or is not ").concat(a))),t++)})}),t>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(function(e){var t=e&&e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height<720,i=e.excludeUntil===1/0&&e.lastExcludeReason_===n;t&&i&&(delete e.excludeUntil,rf.log.warn("enabling non-HD playlist ".concat(e.id," because all playlists were excluded due to ").concat(n," key IDs")))})}}},{key:"addKeyStatus_",value:function(e,t){var n,i=("string"==typeof e?e:(n=new Uint8Array(e),Array.from(n).map(function(e){return e.toString(16).padStart(2,"0")}).join(""))).slice(0,32).toLowerCase();this.logger_("KeyStatus '".concat(t,"' with key ID ").concat(i," added to the keyStatusMap")),this.keyStatusMap_.set(i,t)}},{key:"updatePlaylistByKeyStatus",value:function(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))}},{key:"excludeNonUsableThenChangePlaylist_",value:function(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}])}(),Iv=y(function e(t,n,i){g(this,e);var r,a,s,o=t.playlistController_,u=o.fastQualityChange_.bind(o);if(n.attributes){var l=n.attributes.RESOLUTION;this.width=l&&l.width,this.height=l&&l.height,this.bandwidth=n.attributes.BANDWIDTH,this.frameRate=n.attributes["FRAME-RATE"]}this.codecs=lg(o.main(),n),this.playlist=n,this.id=i,this.enabled=(r=t.playlists,a=n.id,s=u,function(e){var t=r.main.playlists[a],n=Uf(t),i=Mf(t);if(void 0===e)return i;e?delete t.disabled:t.disabled=!0;var o={renditionInfo:{id:a,bandwidth:t.attributes.BANDWIDTH,resolution:t.attributes.RESOLUTION,codecs:t.attributes.CODECS},cause:"fast-quality"};return e===i||n||(e?(s(t),r.trigger({type:"renditionenabled",metadata:o})):r.trigger({type:"renditiondisabled",metadata:o})),e})}),xv=["seeking","seeked","pause","playing","error"],Lv=function(){function e(t){var n;g(this,e),(n=c(this,e)).playlistController_=t.playlistController,n.tech_=t.tech,n.seekable=t.seekable,n.allowSeeksWithinUnsafeLiveWindow=t.allowSeeksWithinUnsafeLiveWindow,n.liveRangeSafeTimeDelta=t.liveRangeSafeTimeDelta,n.media=t.media,n.playedRanges_=[],n.consecutiveUpdates=0,n.lastRecordedTime=null,n.checkCurrentTimeTimeout_=null,n.logger_=ff("PlaybackWatcher"),n.logger_("initialize");var i=function(){return n.monitorCurrentTime_()},r=function(){return n.monitorCurrentTime_()},a=function(){return n.techWaiting_()},s=function(){return n.resetTimeUpdate_()},o=n.playlistController_,u=["main","subtitle","audio"],l={};u.forEach(function(e){l[e]={reset:function(){return n.resetSegmentDownloads_(e)},updateend:function(){return n.checkSegmentDownloads_(e)}},o["".concat(e,"SegmentLoader_")].on("appendsdone",l[e].updateend),o["".concat(e,"SegmentLoader_")].on("playlistupdate",l[e].reset),n.tech_.on(["seeked","seeking"],l[e].reset)});var d=function(e){["main","audio"].forEach(function(t){o["".concat(t,"SegmentLoader_")][e]("appended",n.seekingAppendCheck_)})};return n.seekingAppendCheck_=function(){n.fixesBadSeeks_()&&(n.consecutiveUpdates=0,n.lastRecordedTime=n.tech_.currentTime(),d("off"))},n.clearSeekingAppendCheck_=function(){return d("off")},n.watchForBadSeeking_=function(){n.clearSeekingAppendCheck_(),d("on")},n.tech_.on("seeked",n.clearSeekingAppendCheck_),n.tech_.on("seeking",n.watchForBadSeeking_),n.tech_.on("waiting",a),n.tech_.on(xv,s),n.tech_.on("canplay",r),n.tech_.one("play",i),n.dispose=function(){n.clearSeekingAppendCheck_(),n.logger_("dispose"),n.tech_.off("waiting",a),n.tech_.off(xv,s),n.tech_.off("canplay",r),n.tech_.off("play",i),n.tech_.off("seeking",n.watchForBadSeeking_),n.tech_.off("seeked",n.clearSeekingAppendCheck_),u.forEach(function(e){o["".concat(e,"SegmentLoader_")].off("appendsdone",l[e].updateend),o["".concat(e,"SegmentLoader_")].off("playlistupdate",l[e].reset),n.tech_.off(["seeked","seeking"],l[e].reset)}),n.checkCurrentTimeTimeout_&&wn.clearTimeout(n.checkCurrentTimeTimeout_),n.resetTimeUpdate_()},n}return f(e,rf.EventTarget),y(e,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&wn.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=wn.setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"resetSegmentDownloads_",value:function(e){var t=this.playlistController_["".concat(e,"SegmentLoader_")];this["".concat(e,"StalledDownloads_")]>0&&this.logger_("resetting possible stalled download count for ".concat(e," loader")),this["".concat(e,"StalledDownloads_")]=0,this["".concat(e,"Buffered_")]=t.buffered_()}},{key:"checkSegmentDownloads_",value:function(e){var t=this.playlistController_,n=t["".concat(e,"SegmentLoader_")],i=n.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(var n=0;n<e.length;n++)if(e.start(n)!==t.start(n)||e.end(n)!==t.end(n))return!0;return!1}(this["".concat(e,"Buffered_")],i);if(this["".concat(e,"Buffered_")]=i,r){var a={bufferedRanges:i};return t.trigger({type:"bufferedrangeschanged",metadata:a}),void this.resetSegmentDownloads_(e)}this["".concat(e,"StalledDownloads_")]++,this.logger_("found #".concat(this["".concat(e,"StalledDownloads_")]," ").concat(e," appends that did not increase buffer (possible stalled download)"),{playlistId:n.playlist_&&n.playlist_.id,buffered:Sf(i)}),this["".concat(e,"StalledDownloads_")]<10||(this.logger_("".concat(e," loader stalled download exclusion")),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:"vhs-".concat(e,"-download-exclusion")}),"subtitle"!==e&&t.excludePlaylist({error:{message:"Excessive ".concat(e," segment downloading detected.")},playlistExclusionDuration:1/0}))}},{key:"checkCurrentTime_",value:function(){if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+yf>=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(gf([this.lastRecordedTime,e]));var n={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:n}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}}},{key:"resetTimeUpdate_",value:function(){this.consecutiveUpdates=0}},{key:"fixesBadSeeks_",value:function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),n=this.tech_.currentTime();this.afterSeekableWindow_(t,n,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1));if(this.beforeSeekableWindow_(t,n)){var i=t.start(0);e=i+(i===t.end(0)?0:yf)}if(void 0!==e)return this.logger_("Trying to seek outside of seekable at time ".concat(n," with ")+"seekable range ".concat(kf(t),". Seeking to ")+"".concat(e,".")),this.tech_.setCurrentTime(e),!0;for(var r=this.playlistController_.sourceUpdater_,a=this.tech_.buffered(),s=r.audioBuffer?r.audioBuffered():null,o=r.videoBuffer?r.videoBuffered():null,u=this.media(),l=u.partTargetDuration?u.partTargetDuration:2*(u.targetDuration-vf),c=[s,o],d=0;d<c.length;d++){if(c[d])if(Ef(c[d],n)<l)return!1}var h=Tf(a,n);return 0!==h.length&&(e=h.start(0)+yf,this.logger_("Buffered region starts (".concat(h.start(0),") ")+" just beyond seek point (".concat(n,"). Seeking to ").concat(e,".")),this.tech_.setCurrentTime(e),!0)}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var e=this.tech_.currentTime(),t=this.tech_.buffered(),n=bf(t,e);return n.length&&e+3<=n.end(0)?(this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_("Stopped at ".concat(e," while inside a buffered region ")+"[".concat(n.start(0)," -> ").concat(n.end(0),"]. Attempting to resume ")+"playback by seeking to the current time."),void this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"})):void 0}}},{key:"techWaiting_",value:function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){var n=e.end(e.length-1);return this.logger_("Fell out of live window at time ".concat(t,". Seeking to ")+"live point (seekable end) ".concat(n)),this.resetTimeUpdate_(),this.tech_.setCurrentTime(n),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}var i=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;var a=Tf(r,t);return a.length>0&&(this.logger_("Stopped at ".concat(t," and seeking to ").concat(a.start(0))),this.resetTimeUpdate_(),this.skipTheGap_(t),!0)}},{key:"afterSeekableWindow_",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!e.length)return!1;var r=e.end(e.length-1)+yf,a=!n.endList,s="number"==typeof n.partTargetDuration;return a&&(s||i)&&(r=e.end(e.length-1)+3*n.targetDuration),t>r}},{key:"beforeSeekableWindow_",value:function(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}},{key:"videoUnderflow_",value:function(e){var t=e.videoBuffered,n=e.audioBuffered,i=e.currentTime;if(t){var r;if(t.length&&n.length){var a=bf(t,i-3),s=bf(t,i),o=bf(n,i);o.length&&!s.length&&a.length&&(r={start:a.end(0),end:o.end(0)})}else{Tf(t,i).length||(r=this.gapFromVideoUnderflow_(t,i))}return!!r&&(this.logger_("Encountered a gap in video from ".concat(r.start," to ").concat(r.end,". ")+"Seeking to current time ".concat(i)),!0)}}},{key:"skipTheGap_",value:function(e){var t=this.tech_.buffered(),n=this.tech_.currentTime(),i=Tf(t,n);if(this.resetTimeUpdate_(),0!==i.length&&n===e){this.logger_("skipTheGap_:","currentTime:",n,"scheduled currentTime:",e,"nextRange start:",i.start(0)),this.tech_.setCurrentTime(i.start(0)+vf);var r={gapInfo:{from:n,to:i.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:r}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}}},{key:"gapFromVideoUnderflow_",value:function(e,t){for(var n=function(e){if(e.length<2)return gf();for(var t=[],n=1;n<e.length;n++){var i=e.end(n-1),r=e.start(n);t.push([i,r])}return gf(t)}(e),i=0;i<n.length;i++){var r=n.start(i),a=n.end(i);if(t-r<4&&t-r>2)return{start:r,end:a}}return null}}])}(),Dv={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Pv=function(e,t){var n=0,i=0,r=mf(Dv,t);e.ready(function(){e.trigger({type:"usage",name:"vhs-error-reload-initialized"})});var a=function(){i&&e.currentTime(i)},s=function(t){null!=t&&(i=e.duration()!==1/0&&e.currentTime()||0,e.one("loadedmetadata",a),e.src(t),e.trigger({type:"usage",name:"vhs-error-reload"}),e.play())},o=function(){if(Date.now()-n<1e3*r.errorInterval)e.trigger({type:"usage",name:"vhs-error-reload-canceled"});else{if(r.getSource&&"function"==typeof r.getSource)return n=Date.now(),r.getSource.call(e,s);rf.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}},u=function(){e.off("loadedmetadata",a),e.off("error",o),e.off("dispose",u)};e.on("error",o),e.on("dispose",u),e.reloadSourceOnError=function(t){u(),Pv(e,t)}},Rv="3.16.2",Ov={PlaylistLoader:sm,Playlist:Hf,utils:vm,STANDARD_PLAYLIST_SELECTOR:gg,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.main.playlists.filter(Hf.isEnabled);return pg(t,function(e,t){return fg(e,t)}),t.filter(function(t){return!!lg(e.playlists.main,t).video})[0]||null},lastBandwidthSelector:gg,movingAverageBandwidthSelector:function(e){var t=-1,n=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var i=this.useDevicePixelRatio&&wn.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),t<0&&(t=this.systemBandwidth,n=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==n&&(t=e*this.systemBandwidth+(1-e)*t,n=this.systemBandwidth),mg(this.playlists.main,t,parseInt(hg(this.tech_.el(),"width"),10)*i,parseInt(hg(this.tech_.el(),"height"),10)*i,this.limitRenditionByPlayerDimensions,this.playlistController_)}},comparePlaylistBandwidth:fg,comparePlaylistResolution:function(e,t){var n,i;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(n=e.attributes.RESOLUTION.width),n=n||wn.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(i=t.attributes.RESOLUTION.width),n===(i=i||wn.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:n-i},xhr:um()};Object.keys(xm).forEach(function(e){Object.defineProperty(Ov,e,{get:function(){return rf.log.warn("using Vhs.".concat(e," is UNSAFE be sure you know what you are doing")),xm[e]},set:function(t){rf.log.warn("using Vhs.".concat(e," is UNSAFE be sure you know what you are doing")),"number"!=typeof t||t<0?rf.log.warn("value of Vhs.".concat(e," must be greater than or equal to 0")):xm[e]=t}})});var Nv="videojs-vhs",Uv=function(e,t){for(var n=t.media(),i=-1,r=0;r<e.length;r++)if(e[r].id===n.id){i=r;break}e.selectedIndex_=i,e.trigger({selectedIndex:i,type:"change"})};Ov.canPlaySource=function(){return rf.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};var Mv=function(e){var t=e.player,n=e.sourceKeySystems,i=e.audioMedia,r=e.mainPlaylists;if(!t.eme.initializeMediaKeys)return Promise.resolve();var a=function(e,t){return e.reduce(function(e,n){if(!n.contentProtection)return e;var i=t.reduce(function(e,t){var i=n.contentProtection[t];return i&&i.pssh&&(e[t]={pssh:i.pssh}),e},{});return Object.keys(i).length&&e.push(i),e},[])}(i?r.concat([i]):r,Object.keys(n)),s=[],o=[];return a.forEach(function(e){o.push(new Promise(function(e,n){t.tech_.one("keysessioncreated",e)})),s.push(new Promise(function(n,i){t.eme.initializeMediaKeys({keySystems:e},function(e){e?i(e):n()})}))}),Promise.race([Promise.all(s),Promise.race(o)])},Bv=function(e){var t=e.player,n=function(e,t,n){if(!e)return e;var i={};t&&t.attributes&&t.attributes.CODECS&&(i=og(gr(t.attributes.CODECS))),n&&n.attributes&&n.attributes.CODECS&&(i.audio=n.attributes.CODECS);var r=yr(i.video),a=yr(i.audio),s={};for(var o in e)s[o]={},a&&(s[o].audioContentType=a),r&&(s[o].videoContentType=r),t.contentProtection&&t.contentProtection[o]&&t.contentProtection[o].pssh&&(s[o].pssh=t.contentProtection[o].pssh),"string"==typeof e[o]&&(s[o].url=e[o]);return mf(e,s)}(e.sourceKeySystems,e.media,e.audioMedia);return!!n&&(t.currentSource().keySystems=n,!(n&&!t.eme)||(rf.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))},jv=function(){if(!wn.localStorage)return null;var e=wn.localStorage.getItem(Nv);if(!e)return null;try{return JSON.parse(e)}catch(vy){return null}},Fv=function(e,t){e._requestCallbackSet||(e._requestCallbackSet=new Set),e._requestCallbackSet.add(t)},qv=function(e,t){e._responseCallbackSet||(e._responseCallbackSet=new Set),e._responseCallbackSet.add(t)},Vv=function(e,t){e._requestCallbackSet&&(e._requestCallbackSet.delete(t),e._requestCallbackSet.size||delete e._requestCallbackSet)},Hv=function(e,t){e._responseCallbackSet&&(e._responseCallbackSet.delete(t),e._responseCallbackSet.size||delete e._responseCallbackSet)};Ov.supportsNativeHls=function(){if(!Ln||!Ln.createElement)return!1;var e=Ln.createElement("video");if(!rf.getTech("Html5").isSupported())return!1;return["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(e.canPlayType(t))})}(),Ov.supportsNativeDash=!!(Ln&&Ln.createElement&&rf.getTech("Html5").isSupported())&&/maybe|probably/i.test(Ln.createElement("video").canPlayType("application/dash+xml")),Ov.supportsTypeNatively=function(e){return"hls"===e?Ov.supportsNativeHls:"dash"===e&&Ov.supportsNativeDash},Ov.isSupported=function(){return rf.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")},Ov.xhr.onRequest=function(e){Fv(Ov.xhr,e)},Ov.xhr.onResponse=function(e){qv(Ov.xhr,e)},Ov.xhr.offRequest=function(e){Vv(Ov.xhr,e)},Ov.xhr.offResponse=function(e){Hv(Ov.xhr,e)};var zv=rf.getComponent("Component"),Wv=function(){function e(t,n,i){var r;if(g(this,e),r=c(this,e,[n,i.vhs]),"number"==typeof i.initialBandwidth&&(r.options_.bandwidth=i.initialBandwidth),r.logger_=ff("VhsHandler"),n.options_&&n.options_.playerId){var a=rf.getPlayer(n.options_.playerId);r.player_=a}if(r.tech_=n,r.source_=t,r.stats={},r.ignoreNextSeekingEvent_=!1,r.setOptions_(),r.options_.overrideNative&&n.overrideNativeAudioTracks&&n.overrideNativeVideoTracks)n.overrideNativeAudioTracks(!0),n.overrideNativeVideoTracks(!0);else if(r.options_.overrideNative&&(n.featuresNativeVideoTracks||n.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");return r.on(Ln,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(e){var t=Ln.fullscreenElement||Ln.webkitFullscreenElement||Ln.mozFullScreenElement||Ln.msFullscreenElement;t&&t.contains(r.tech_.el())?r.playlistController_.fastQualityChange_():r.playlistController_.checkABR_()}),r.on(r.tech_,"seeking",function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())}),r.on(r.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),r.on(r.tech_,"play",r.play),r}return f(e,zv),y(e,[{key:"setOptions_",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.options_=mf(this.options_,t),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=void 0!==this.source_.useBandwidthFromLocalStorage?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=!1!==this.options_.llhls,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,"number"!=typeof this.options_.playlistExclusionDuration&&(this.options_.playlistExclusionDuration=60),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage){var n=jv();n&&n.bandwidth&&(this.options_.bandwidth=n.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),n&&n.throughput&&(this.options_.throughput=n.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=xm.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===xm.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(function(t){void 0!==e.source_[t]&&(e.options_[t]=e.source_[t])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;var i=this.options_.customPixelRatio;"number"==typeof i&&i>=0&&(this.customPixelRatio=i)}},{key:"setOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setOptions_(e)}},{key:"src",value:function(e,t){var n=this;if(e){var i;this.setOptions_(),this.options_.src=0===(i=this.source_.src).toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")?JSON.parse(i.substring(i.indexOf(",")+1)):i,this.options_.tech=this.tech_,this.options_.externVhs=Ov,this.options_.sourceType=wr(t),this.options_.seekTo=function(e){n.tech_.setCurrentTime(e)},this.options_.player_=this.player_,this.playlistController_=new Av(this.options_);var r=mf({liveRangeSafeTimeDelta:yf},this.options_,{seekable:function(){return n.seekable()},media:function(){return n.playlistController_.media()},playlistController:this.playlistController_});this.playbackWatcher_=new Lv(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",function(){var e=rf.players[n.tech_.options_.playerId],t=n.playlistController_.error;"object"!==k(t)||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)});var a=this.options_.bufferBasedABR?Ov.movingAverageBandwidthSelector(.55):Ov.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):a.bind(this),this.playlistController_.selectInitialPlaylist=Ov.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.playlistController_.selectPlaylist},set:function(e){this.playlistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.playlistController_.mainSegmentLoader_.throughput.rate=e,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){var e=this.playlistController_.mainSegmentLoader_.bandwidth,t=wn.navigator.connection||wn.navigator.mozConnection||wn.navigator.webkitConnection,n=1e7;if(this.options_.useNetworkInformationApi&&t){var i=1e3*t.downlink*1e3;e=i>=n&&e>=n?Math.max(e,i):i}return e},set:function(e){this.playlistController_.mainSegmentLoader_.bandwidth=e,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e,t=1/(this.bandwidth||1);return e=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){rf.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:function(){return n.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return n.playlistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return n.playlistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return n.playlistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return n.playlistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return n.playlistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return n.playlistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return n.playlistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return n.playlistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return n.playlistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return n.playlistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return n.playlistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return n.playlistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return Sf(n.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return n.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return n.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return n.tech_.name_},enumerable:!0},duration:{get:function(){return n.tech_.duration()},enumerable:!0},main:{get:function(){return n.playlists.main},enumerable:!0},playerDimensions:{get:function(){return n.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return Sf(n.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return n.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",function(){n.options_.useBandwidthFromLocalStorage&&function(e){if(!wn.localStorage)return!1;var t=jv();t=t?mf(t,e):e;try{wn.localStorage.setItem(Nv,JSON.stringify(t))}catch(vy){return!1}}({bandwidth:n.bandwidth,throughput:Math.round(n.throughput)})}),this.playlistController_.on("selectedinitialmedia",function(){var e;(e=n).representations=function(){var t=e.playlistController_.main(),n=Vf(t)?e.playlistController_.getAudioTrackPlaylists_():t.playlists;return n?n.filter(function(e){return!Uf(e)}).map(function(t,n){return new Iv(e,t,t.id)}):[]}}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",function(){n.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_=wn.URL.createObjectURL(this.playlistController_.mediaSource),(rf.browser.IS_ANY_SAFARI||rf.browser.IS_IOS)&&this.options_.overrideNative&&"hls"===this.options_.sourceType&&"function"==typeof this.tech_.addSourceElement?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}}},{key:"createKeySessions_",value:function(){var e=this,t=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Mv({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.main.playlists}).then(function(){e.logger_("created EME key session"),e.playlistController_.sourceUpdater_.initializedEme()}).catch(function(t){e.logger_("error while creating EME key session",t),e.player_.error({message:"Failed to initialize media keys for EME",code:3})})}},{key:"handleWaitingForKey_",value:function(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}},{key:"setupEme_",value:function(){var e=this,t=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,n=Bv({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});this.player_.tech_.on("keystatuschange",function(t){e.playlistController_.updatePlaylistByKeyStatus(t.keyId,t.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),n?this.createKeySessions_():this.playlistController_.sourceUpdater_.initializedEme()}},{key:"setupQualityLevels_",value:function(){var e=this,t=rf.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.playlistController_.on("selectedinitialmedia",function(){var t,n;t=e.qualityLevels_,(n=e).representations().forEach(function(e){t.addQualityLevel(e)}),Uv(t,n.playlists)}),this.playlists.on("mediachange",function(){Uv(e.qualityLevels_,e.playlists)}))}},{key:"version",value:function(){return this.constructor.version()}},{key:"canChangeType",value:function(){return Zg.canChangeType()}},{key:"play",value:function(){this.playlistController_.play()}},{key:"setCurrentTime",value:function(e){this.playlistController_.setCurrentTime(e)}},{key:"duration",value:function(){return this.playlistController_.duration()}},{key:"seekable",value:function(){return this.playlistController_.seekable()}},{key:"dispose",value:function(){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_&&wn.URL.revokeObjectURL&&(wn.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),n(e,"dispose",this,3)([])}},{key:"convertToProgramTime",value:function(e,t){return ym({playlist:this.playlistController_.media(),time:e,callback:t})}},{key:"seekToProgramTime",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;return _m({programTime:e,playlist:this.playlistController_.media(),retryCount:i,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}},{key:"setupXhrHooks_",value:function(){var e=this;this.xhr.onRequest=function(t){Fv(e.xhr,t)},this.xhr.onResponse=function(t){qv(e.xhr,t)},this.xhr.offRequest=function(t){Vv(e.xhr,t)},this.xhr.offResponse=function(t){Hv(e.xhr,t)},this.player_.trigger("xhr-hooks-ready")}},{key:"attachStreamingEventListeners_",value:function(){var e=this;["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(function(t){e.playlistController_.on(t,function(t){e.player_.trigger($({},t))})}),["gapjumped","playedrangeschanged"].forEach(function(t){e.playbackWatcher_.on(t,function(t){e.player_.trigger($({},t))})})}}],[{key:"version",value:function(){return{"@videojs/http-streaming":Rv,"mux.js":"7.1.0","mpd-parser":"1.3.1","m3u8-parser":"7.2.0","aes-decrypter":"4.0.2"}}}])}(),Gv={name:"videojs-http-streaming",VERSION:Rv,canHandleSource:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=mf(rf.options,t);return!(!n.vhs.experimentalUseMMS&&!_r("avc1.4d400d,mp4a.40.2",!1))&&Gv.canPlayType(e.type,n)},handleSource:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=mf(rf.options,n);return t.vhs=new Wv(e,t,i),t.vhs.xhr=um(),t.vhs.setupXhrHooks_(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){var n=wr(e);if(!n)return"";var i=Gv.getOverrideNative(t);return!Ov.supportsTypeNatively(n)||i?"maybe":""},getOverrideNative:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).vhs,t=void 0===e?{}:e,n=!(rf.browser.IS_ANY_SAFARI||rf.browser.IS_IOS),i=t.overrideNative;return void 0===i?n:i}};_r("avc1.4d400d,mp4a.40.2",!0)&&rf.getTech("Html5").registerSourceHandler(Gv,0),rf.VhsHandler=Wv,rf.VhsSourceHandler=Gv,rf.Vhs=Ov,rf.use||rf.registerComponent("Vhs",Ov),rf.options.vhs=rf.options.vhs||{},rf.getPlugin&&rf.getPlugin("reloadSourceOnError")||rf.registerPlugin("reloadSourceOnError",function(e){Pv(this,e)});var Xv=y(function e(t){for(var n in g(this,e),this.id=t.getAttribute("id"),this.allowMultipleAds=t.getAttribute("allowMultipleAds"),this.followRedirects=t.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null,t.childNodes){var i=t.childNodes[n];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&&1!==this.vastAdData.nodeType;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=i}}});function Kv(e,t){var n=[];for(var i in e.childNodes){var r=e.childNodes[i];r.nodeName!==t&&t!=="vmap:".concat(r.nodeName)&&r.nodeName!=="vmap:".concat(t)||n.push(r)}return n}function Yv(e){var t={attributes:{},children:{},value:{}};t.value=function(e){if(!e||!e.childNodes)return{};var t=e.childNodes,n=[];for(var i in t){var r=t[i];"#cdata-section"===r.nodeName&&n.push(r)}if(n&&n.length>0)try{return JSON.parse(n[0].data)}catch(vy){}var a="";for(var s in t){var o=t[s];switch(o.nodeName){case"#text":a+=o.textContent.trim();break;case"#cdata-section":a+=o.data}}return a}(e);var n=e.attributes;if(n)for(var i in n){var r=n[i];r.nodeName&&void 0!==r.nodeValue&&null!==r.nodeValue&&(t.attributes[r.nodeName]=r.nodeValue)}var a=e.childNodes;if(a)for(var s in a){var o=a[s];o.nodeName&&"#"!==o.nodeName.substring(0,1)&&(t.children[o.nodeName]=Yv(o))}return t}var Qv=function(){return y(function e(t){for(var n in g(this,e),this.timeOffset=t.getAttribute("timeOffset"),this.breakType=t.getAttribute("breakType"),this.breakId=t.getAttribute("breakId"),this.repeatAfter=t.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[],t.childNodes){var i=t.childNodes[n];switch(i.localName){case"AdSource":this.adSource=new Xv(i);break;case"TrackingEvents":for(var r in i.childNodes){var a=i.childNodes[r];"Tracking"===a.localName&&this.trackingEvents.push({event:a.getAttribute("event"),uri:(a.textContent||a.text||"").trim()})}break;case"Extensions":this.extensions=Kv(i,"Extension").map(function(e){return Yv(e)})}}},[{key:"track",value:function(e,t){for(var n in this.trackingEvents){var i=this.trackingEvents[n];if(i.event===e){var r=i.uri;"error"===i.event&&(r=r.replace("[ERRORCODE]",t)),this.tracker(r)}}}},{key:"tracker",value:function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)}}])}(),$v=y(function e(t){if(g(this,e),!t||!t.documentElement||"VMAP"!==t.documentElement.localName)throw new Error("Not a VMAP document");for(var n in this.version=t.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[],t.documentElement.childNodes){var i=t.documentElement.childNodes[n];switch(i.localName){case"AdBreak":this.adBreaks.push(new Qv(i));break;case"Extensions":this.extensions=Kv(i,"Extension").map(function(e){return Yv(e)})}}}),Jv=new Tn,Zv=function(e){return e.creatives.find(function(e){return e.mediaFiles})},ey=function(e){var t,n=null==e?void 0:e.mediaFiles;return null!=n&&n.length&&(null==(t=n.find(function(e){return e.fileURL}))?void 0:t.fileURL)||""},ty=R.a({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),ny=function(e,t){var n=S(O.useState(),2),i=n[0],a=n[1],s=O.useRef(Date.now()),u=O.useRef(Date.now());return O.useEffect(function(){if(t&&null!=e&&e.current){var n=function(e,t){var n=goog.pal,i=new n.ConsentSettings;i.allowStorage=!1;var a=new n.NonceLoader(i);return o(r().m(function i(){var s,o,u,l,c,d;return r().w(function(i){for(;;)switch(i.p=i.n){case 0:return i.p=0,s=new URL(t),o=new n.NonceRequest,u=localStorage.getItem("sl-device-id")||U.v4(),(l=sessionStorage.getItem("sl-ad-session-id"))||(l=U.v4(),sessionStorage.setItem("sl-ad-session-id",l)),z(u)||(u=Q("https://".concat(u),Q.URL)),s.searchParams.get("url")||s.searchParams.set("url","https://streamlayer.io"),s.searchParams.get("description_url")||s.searchParams.set("description_url","https://streamlayer.io"),o.adWillAutoPlay="auto"===s.searchParams.get("vpa"),o.adWillPlayMuted="1"===s.searchParams.get("vpmute"),o.continuousPlayback=!0,o.descriptionUrl=s.searchParams.get("description_url"),o.iconsSupported=!0,o.sessionId=u,o.supportedApiFrameworks="2,7,9",o.videoHeight=e.clientHeight,o.videoWidth=e.clientWidth,i.n=1,a.loadNonceManager(o);case 1:return c=i.v,i.a(2,("[placeholder]"===s.searchParams.get("is_lat")&&s.searchParams.set("is_lat","1"),"[placeholder]"===s.searchParams.get("rdid")&&s.searchParams.set("rdid",u),"[placeholder]"===s.searchParams.get("correlator")&&s.searchParams.set("correlator",l),s.searchParams.set("wta","1"),s.searchParams.set("givn",c.getNonce()),{url:s,manager:c}));case 2:return i.p=2,d=i.v,console.log("AdsManager could not be started",d),i.a(2)}},i,null,[[0,2]])}))}(e.current,t),i=Date.now();s.current=i,ty.set({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),n().then(function(e){s.current===i&&e&&(a(e.url),ty.set({ads:[],autoplay:!0,muted:!1,nonceManager:e.manager}))}).catch(function(e){console.error(e)})}},[e,t]),O.useEffect(function(){var e=function(){var e=o(r().m(function e(t,n){var i,a,s,o,c,d,h,p;return r().w(function(e){for(;;)switch(e.n){case 0:if(i=[],"vmap"!==t.searchParams.get("output")){e.n=3;break}return e.n=1,fetch(t.toString());case 1:return a=e.v,s=new DOMParser,e.n=2,a.text();case 2:o=e.v,c=s.parseFromString(o,"text/xml"),i=new $v(c).adBreaks.map(function(e){return e.adSource.adTagURI.uri}),e.n=4;break;case 3:i=[t.toString()];case 4:return e.n=5,Promise.all(i.map(function(e,t){return Jv.get(e).then(function(e){if(u.current===n){var i=e.ads.find(function(e){return e.creatives.length>0});if(!i)return;var r=Zv(i),a=ey(r);return{creative:r,order:t,mediaFileUrl:a,ad:i,raw:e}}})}));case 5:d=e.v,h="click"!==t.searchParams.get("vpa"),p="1"===t.searchParams.get("vpmute"),ty.set(l(l({},ty.get()),{},{ads:d.filter(function(e){return!!e}),autoplay:h,muted:p}));case 6:return e.a(2)}},e)}));return function(t,n){return e.apply(this,arguments)}}();if(i){var t=Date.now();u.current=t,e(i,t)}return function(){u.current=0}},[i]),ty},iy={time:0,adCount:0,adPosition:0,skipDelay:0,playing:!1,paused:!1,reset:function(){},whyThisAd:null,hasAdUrl:!1,adAction:function(e){},playMuted:!1,muted:!1,autoplay:!0},ry=R.f(iy),ay=function(e){if(!e)return 0;var t=e.duration(),n=e.currentTime();return void 0===t||isNaN(t)||void 0===n||isNaN(n)?0:Math.round(t-n)},sy=function(e,t){var n=ny(e,t),i=function(e){var t=O.useRef();return O.useEffect(function(){if(!t.current&&e.current){var n=document.createElement("video-js");n.classList.add("vjs-big-play-centered"),e.current.appendChild(n),t.current=rf(n,{controls:!1,playsinline:!0})}return function(){t.current&&(t.current.dispose(),t.current=void 0)}},[]),t}(e),r=O.useRef(),a=O.useRef(!1),s=O.useRef(!1),o=O.useCallback(function(){if(!s.current){var e=n.get().nonceManager;if(e&&a.current)try{e.sendPlaybackEnd()}catch(t){console.warn("[PAL] sendPlaybackEnd failed",t)}s.current=!0}},[n]),u=O.useCallback(function(){o(),i.current&&(i.current.pause(),i.current.src(void 0)),r.current=void 0,ry.set(l(l({},iy),{},{reset:u}))},[i,o]);O.useEffect(function(){ry.setKey("reset",u)},[u]);var c=O.useCallback(function(){var e,t,a,s=ry.get(),o=s.adPosition,l=s.adCount;if(i.current){if(o<l){var c=o+1,d=n.get(),h=d.ads,p=d.muted,f=d.autoplay,m=d.nonceManager,g=h[c-1];if(g)return null==(e=r.current)||e.complete(),r.current=new kn(null,g.ad,g.creative),r.current.on("clickthrough",function(e){if(m)try{m.sendAdClick()}catch(t){console.warn("[PAL] sendAdClick failed",t)}window.open(e,"_blank")}),ry.setKey("adPosition",c),ry.setKey("playMuted",p),ry.setKey("skipDelay",g.creative.skipDelay||0),ry.setKey("time",0),ry.setKey("adAction",function(e){r.current&&r.current.click(null,{CLICKPOS:[e.clientX,e.clientY]})}),ry.setKey("whyThisAd",g.creative.icons.find(function(e){return"GoogleWhyThisAd"===e.program})||null),ry.setKey("hasAdUrl",!(null==(t=g.creative.videoClickThroughURLTemplate)||!t.url)),i.current.src(g.mediaFileUrl),ry.setKey("playing",!0),void(0===o?(ry.setKey("muted",p),ry.setKey("autoplay",f),p&&i.current.muted(!0),f?i.current.play():(i.current.pause(),ry.setKey("paused",!0))):i.current.play())}null==(a=r.current)||a.complete(),u()}},[i,u,n]),d=O.useCallback(function(){if(i.current){var e=i.current.muted();i.current.muted(!e),ry.setKey("muted",!e),r.current&&r.current.setMuted(!e)}},[i]),h=O.useCallback(function(){i.current&&(i.current.paused()?(i.current.play(),r.current&&r.current.setPaused(!1)):(i.current.pause(),r.current&&r.current.setPaused(!0)))},[i]),p=O.useCallback(function(){i.current&&(r.current&&r.current.skip(),c())},[c,i]);return O.useEffect(function(){var e=i.current;if(!e)return function(){};var t=function(e){if(ry.setKey("playing",!0),ry.setKey("paused",!1),ry.setKey("time",ay(e.target.player)),!a.current){var t=n.get().nonceManager;if(t)try{t.sendPlaybackStart(),a.current=!0,s.current=!1}catch(Ki){console.warn("[PAL] sendPlaybackStart failed",Ki)}}},o=function(){var e;null==(e=r.current)||e.complete(),c()},l=function(e){ry.setKey("muted",e.target.player.muted())},d=function(){ry.setKey("paused",!0)},p=function(e){"VIDEO"===e.target.tagName&&(ry.get().autoplay||h())},f=function(e){ry.setKey("time",ay(e.target.player)),r.current&&r.current.setProgress(e.target.player.currentTime())},m=function(){u()};return e.on("play",t),e.on("ended",o),e.on("muted",l),e.on("pause",d),e.on("click",p),e.on("timeupdate",f),e.on("error",m),function(){e.off("play",t),e.off("ended",o),e.off("muted",l),e.off("pause",d),e.off("click",p),e.off("timeupdate",f),e.off("error",m)}},[h,c,i,u,n]),O.useEffect(function(){return n.subscribe(function(e){e&&(a.current=!1,s.current=!1,ry.setKey("adCount",e.ads.length),ry.setKey("adPosition",0),c())})},[n,i,c]),O.useEffect(function(){return function(){u()}},[u]),[ry,d,h,p,r]},oy=function(e){var t,n,i,r,a,s=e.promotion,o=e.onClose,u=e.promotionId,l=e.externalAd,c=e.skipAutoClose,d=O.useRef(null),h=S(sy(d,null==l?void 0:l.url),4),p=h[0],f=h[1],m=h[2],g=h[3],v=P.useStore(p),y=v.time,_=v.adCount,b=v.adPosition,T=v.skipDelay,k=v.playing,w=v.paused,E=v.reset,C=v.muted,A=v.playMuted,I=v.autoplay,x=v.whyThisAd,D=v.hasAdUrl,R=v.adAction,N=(null==(t=s.sponsor)?void 0:t.logo)&&s.logoMode===U.PromotionLogoMode.CENTER;return L.jsxs(Qe,{className:"PromoOverlay",children:[L.jsxs($e,{children:[L.jsx(Je,{className:P.cx_default(!N&&Ze),children:L.jsx(ut,{style:{transform:"scale(1.5)"},children:"Ad"})}),L.jsxs(wt,{children:[L.jsx(gt,{time:y,adCount:_,adPosition:b}),!!T&&k&&L.jsx(j.y,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:function(){g()},duration:T,isPlaying:!w,skipIcon:!0}),c&&L.jsx(j.y,{className:"ClosePromoIcon",close:function(){E(),null==o||o()}})]})]}),L.jsx(nt,{className:P.cx_default(Et,k&&Ct,!k&&At),children:L.jsxs(St,{ref:d,children:[x&&L.jsx(yt,{whyThisAd:x}),L.jsxs(_t,{style:"right"===(null==x?void 0:x.xPosition)?{left:"8px"}:{right:"8px"},children:[A&&L.jsx(Tt,{className:P.cx_default(!C&&"muted"),onClick:function(){return f()}}),w&&!I&&L.jsx(kt,{onClick:function(){return m()}})]})]})}),D&&L.jsx(ct,{className:P.cx_default(Et,k&&Ct,!k&&At),children:L.jsx(dt,{as:"button",onClick:R,style:{backgroundColor:(null==(i=null==(n=s.banner)?void 0:n.ctaButton)?void 0:i.color)||"#009dc4",color:(null==(a=null==(r=s.banner)?void 0:r.ctaButton)?void 0:a.textColor)||"#fff"},"data-a":"button","data-promo-id":u,"data-promo-type":s.type,target:"_blank",children:"Show more"})})]})},uy=function(e){var t,n,i,r,a,s,o,u,c,d,h,p,f,m,g,v,y,_,b,T,k,S,w,E,C,A,I,x,D,R,M=e.promotion,B=e.open,F=e.advertisementPaused,q=e.togglePause,V=e.controlVideo,H=e.skipAutoClose,z=e.promotionId,W=e.onClose,G=e.markAsViewed,X=e.externalAd,K=e.isEventFired,Y=e.fireEvent,Q=e.muted,$=M.type===U.PromotionType.INGAME_IAB11_LBAR||M.type===U.PromotionType.INGAME_IAB11||M.type===U.PromotionType.INGAME_IAB11_SIDEBAR,J=(null==(t=M.sponsor)?void 0:t.logo)&&M.logoMode===U.PromotionLogoMode.CENTER,Z=!(null==(i=null==(n=M.banner)?void 0:n.video)||!i.url),ee=M.autoPlayVideo===U.AutoPlayVideo.ENABLED,te=M.playVideoMuted===U.PlayVideoMuted.ENABLED;if(O.useEffect(function(){null==q||q(Z||ee),null==B||B()},[]),O.useEffect(function(){z&&M.type&&G&&G()},[z,M.type,G]),O.useEffect(function(){return function(){null==V||V({muted:!1})}},[V]),X)return L.jsx(oy,l(l({},e),{},{externalAd:X}));var ne=null==(r=M.banner)?void 0:r.url;ne&&0!==ne.indexOf("http")&&(ne="https://".concat(ne));var ie=!0;return Z&&(ie=!F||!ee),L.jsxs(Qe,{className:"PromoOverlay",children:[L.jsxs("div",{children:[L.jsxs($e,{children:[L.jsxs(Je,{className:P.cx_default(!J&&Ze),children:[(null==(a=M.sponsor)?void 0:a.logo)&&M.logoMode===U.PromotionLogoMode.LEFT&&L.jsx(et,{className:"PromoSponsorLogo",src:null==(s=M.sponsor)?void 0:s.logo,alt:"promo"}),L.jsxs(st,{style:{paddingLeft:null!=(o=M.sponsor)&&o.logo&&M.logoMode===U.PromotionLogoMode.LEFT?"0px":"8px"},children:[(null==(u=M.sponsor)?void 0:u.logo)&&M.logoMode===U.PromotionLogoMode.LEFT&&L.jsx(tt,{children:null==(c=M.sponsor)?void 0:c.name}),L.jsxs(ot,{className:"SponsorText",children:[L.jsx(ut,{children:"AD"}),L.jsx(lt,{children:"SPONSORED"})]})]})]}),L.jsx(j.y,{className:"ClosePromoIcon",close:W,autoClose:null==(d=M.closeTimer)?void 0:d.auto,duration:H?0:null==(h=M.closeTimer)?void 0:h.seconds,isPlaying:ie})]}),L.jsxs(nt,{children:[J&&L.jsx(et,{className:"s1nmch9k",src:null==(p=M.sponsor)?void 0:p.logo,alt:"promo"}),L.jsx(rt,{children:null!=(m=null==(f=M.banner)?void 0:f.video)&&m.url?L.jsx(j.Et,{source:null==(v=null==(g=M.banner)?void 0:g.video)?void 0:v.url,poster:null==(_=null==(y=M.banner)?void 0:y.video)?void 0:_.thumbnailUrl,aspectRatio:$?"1/1":"2/1",onRender:function(){null!=K&&K("video-rendered")||(N.eventBus.emit("advertisement",{action:"videoRendered",payload:{id:z,type:M.type}}),null==Y||Y("video-rendered"))},onQuartile:function(e){null!=K&&K("video-quartile-".concat(e))||(N.eventBus.emit("advertisement",{action:"quartileCompleted",payload:{id:z,type:M.type,quartile:e}}),null==Y||Y("video-quartile-".concat(e)))},onMute:function(e){var t=e?"muted":"unmuted";null!=K&&K(t)||(N.eventBus.emit("advertisement",{action:e?"videoMuted":"videoUnmuted",payload:{id:z,type:M.type}}),null==Y||Y(t))},onPause:function(){ee&&(null==q||q(!0))},onReplay:function(){null!=K&&K("replayed")||(N.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:z,type:M.type}}),null==Y||Y("replayed"))},onPlay:function(){null!=K&&K("played")||(N.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:z,type:M.type}}),null==Y||Y("played")),null==q||q(!1),null!=K&&K("played")&&null!=K&&K("ended")&&(null==K||!K("replayed"))&&(N.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:z,type:M.type}}),null==Y||Y("replayed"))},onEnd:function(){null!=K&&K("ended")||(N.eventBus.emit("advertisement",{action:"videoEnd",payload:{id:z,type:M.type}}),null==Y||Y("ended"))},controlVideo:V,autoPlay:ee,playMuted:te,muted:Q}):null!=(b=M.banner)&&b.imageUrl?L.jsx(it,{style:$?{aspectRatio:"1/1"}:{},src:null==(T=M.banner)?void 0:T.imageUrl,alt:"promo"}):null}),!$&&L.jsxs(rt,{children:[(null==(k=M.banner)?void 0:k.title)&&L.jsx(ht,{className:P.cx_default("AdvTitle",J&&"h17rwbtk"),children:null==(S=M.banner)?void 0:S.title}),(null==(w=M.banner)?void 0:w.body)&&L.jsx(at,{className:"AdvDescription",children:null==(E=M.banner)?void 0:E.body})]})]})]}),M.buttonType===U.PromotionButtonType.BASIC&&L.jsx(ct,{children:L.jsx(dt,{href:ne,style:{backgroundColor:(null==(A=null==(C=M.banner)?void 0:C.ctaButton)?void 0:A.color)||"#009dc4",color:(null==(x=null==(I=M.banner)?void 0:I.ctaButton)?void 0:x.textColor)||"#fff"},"data-a":"button","data-promo-id":z,"data-promo-type":M.type,target:"_blank",children:null==(R=null==(D=M.banner)?void 0:D.ctaButton)?void 0:R.label})})]})},ly=P.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),cy=function(e){var t=e.children,n=e.direction,i=e.style,r=e.className,a=e.hiding;return L.jsx(ne,{direction:n,style:i,hiding:a,className:r,children:L.jsx(ly,{children:t})})},dy=function(e){return(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB11_LBAR||(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB21_LBAR},hy=function(e){var t=e.advertisement,n=e.close,i=e.skipTypeCheck,r=e.skipAutoClose,a=(e.layoutMode,e.sidebar),s=e.isNotification,o=e.banner,u=e.markAsViewed,l=e.open,c=e.externalAd,d=e.controlVideo,h=e.advertisementPaused,p=e.togglePause,f=e.isEventFired,m=e.fireEvent,g=e.muted;return t.promotion?s&&t.notification?L.jsx(Ke,{open:function(){return null==l?void 0:l({fromNotification:!0})},notification:t.notification,promotionId:t.question.id,close:n}):a||o||!i&&!function(e){return(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB11||(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB21}(t.promotion)?a&&(i||dy(t.promotion)||function(e){return(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB11_SIDEBAR||(null==e?void 0:e.type)===U.PromotionType.INGAME_IAB21_SIDEBAR}(t.promotion)||c)?L.jsx(cy,{className:"PromoSidebarContainer",direction:a,hiding:!1,children:L.jsx(uy,{markAsViewed:u,promotionId:t.question.id,promotion:t.promotion,externalAd:c,onClose:n,open:l,controlVideo:d,skipAutoClose:r,advertisementPaused:h,togglePause:p,isEventFired:f,fireEvent:m,muted:g})}):o&&dy(t.promotion)?L.jsx(se,{promotionId:t.question.id,hiding:!1,promotion:t.promotion,direction:o,isEventFired:f,fireEvent:m}):null:L.jsx(Ye,{className:"PromoOverlayContainer",children:L.jsx(uy,{markAsViewed:u,promotionId:t.question.id,promotion:t.promotion,onClose:n,open:l,skipAutoClose:r,externalAd:c,controlVideo:d,advertisementPaused:h,togglePause:p,isEventFired:f,fireEvent:m,muted:g})}):null},py=P.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),fy=function(e){var t=e.target;if(t instanceof HTMLAnchorElement&&"_blank"===t.target){var n=t.getAttribute("data-promo-id")||"",i=t.getAttribute("data-promo-type")||U.PromotionType.UNSET;"button"===t.getAttribute("data-a")&&N.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:n,type:i}}),"banner"===t.getAttribute("data-a")&&N.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:n,type:i}})}},my=function(e){var t,n,i,r,a,s,o,u,c,d,h,p,f,m,g,v,y,_,b,T,k,S=e.gamification,w=e.advertisement,E=e.layoutMode,C=e.skipAutoClose,A=e.skipTypeCheck,I=e.sidebar,x=e.banner,D=e.notification,N=e.isMobileScreen,M=e.persistent,B=e.containerId,j=e.externalAd,F=e.controlVideo,V=e.muted,H=O.useRef(null),z=P.useStore(w.$store),W=P.useStore(S.openedQuestion.$store);R.b(H,{enabled:!!z.data,event:"click",listener:fy});var G=(null==(i=null==(n=null==(t=z.data)?void 0:t.question)?void 0:n.backgroundImage)?void 0:i.landscapeUrl)||(null==(a=null==(r=z.data)?void 0:r.promotion)?void 0:a.backgroundImageLandscapeUrl),X=(null==(u=null==(o=null==(s=z.data)?void 0:s.question)?void 0:o.backgroundImage)?void 0:u.portraitUrl)||(null==(d=null==(c=z.data)?void 0:c.promotion)?void 0:d.backgroundImagePortraitUrl),K=q.y({containerId:B,landscapeUrl:G,portraitUrl:X});if((null==(h=null==W?void 0:W.attributes)?void 0:h.adUnit)===U.AdUnit.STANDART&&null!=(m=null==(f=null==(p=null==W?void 0:W.attributes)?void 0:p.adPromotion)?void 0:f.banner)&&m.imageUrl)return x?L.jsx(py,{ref:H,style:{height:"100%"},className:P.cx_default("SL-AdvertisementUIWrap",N&&"mobile-view"),children:L.jsx(oe,{cardId:W.id,promotion:l(l({},null==(g=null==W?void 0:W.attributes)?void 0:g.adPromotion),{},{adUnit:null==(v=null==W?void 0:W.attributes)?void 0:v.adUnit})})}):null;var Y=!x&&!I;if(void 0===z.data||!M&&z.isViewed)return null;var Q=(null==(b=null==(_=null==(y=null==z?void 0:z.data)?void 0:y.notification)?void 0:_.promotion)?void 0:b.mode)===U.NotificationPromotionMode.LOWER_THIRD;return L.jsxs(py,{ref:H,style:{height:Y?"auto":"100%"},className:P.cx_default("SL-AdvertisementUIWrap",N&&"mobile-view",Q&&"SL-AdvertisementUIWrap--lower-third"),children:[!D&&K,L.jsx(hy,{skipTypeCheck:A,sidebar:I,banner:x,advertisement:z.data,advertisementPaused:!!z.isPaused,togglePause:z.togglePause,isEventFired:z.isEventFired,fireEvent:z.fireEvent,close:z.close,externalAd:j?z.externalAd:void 0,markAsViewed:null==(T=S.advertisement)?void 0:T.markAsViewed,open:null==(k=S.advertisement)?void 0:k.open,layoutMode:E,isNotification:D,skipAutoClose:C,controlVideo:F,muted:V})]})},gy=function(e){var t=e.sdk,n=e.sidebar,i=e.externalAd,r=e.banner,a=e.skipAutoClose,s=e.skipTypeCheck,o=e.layoutMode,u=e.isMobileScreen,l=e.persistent,c=e.notification,d=e.muted,h=P.useStore(t.featuresList.getStore()),p=S(O.useState(!i),2),f=p[0],m=p[1],g=P.useStore(t.options);if(O.useEffect(function(){if(i){var e=document.createElement("script");e.async=!0,e.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(e),e.onload=function(){m(!0)}}},[i]),n&&r)return L.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(r&&i)return L.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!h)return null;var v=t.getFeature(U.SdkOverlayType.GAMES);return null==v||!v.advertisement||i&&!f?null:L.jsx(my,{gamification:v,advertisement:v.advertisement,sidebar:n,banner:r,layoutMode:o,isMobileScreen:u,persistent:l,notification:c,skipTypeCheck:s,skipAutoClose:a,externalAd:i,controlVideo:t.controlVideoPlayer,containerId:g.containerId,muted:d})};exports.StreamLayerSDKAdvertisement=function(e){var t=e.event,n=e.sidebar,i=e.banner,r=e.isMobileScreen,a=e.skipAutoClose,s=e.persistent,o=e.theme,u=e.notification,l=e.skipTypeCheck,c=e.externalAd,d=e.muted,h=void 0!==d&&d,p=V.B(),f=V.F(),m=V.z();return p?c&&!f.promotionExternalAd||!c&&f.promotionExternalAd||n&&!f.promotionSidebar||i&&!f.promotionBanner||u&&!f.promotionNotification?void 0!==t&&L.jsx(V.j,{event:t}):i||n||u||f.promotionOverlay||l?L.jsxs("div",{className:"StreamLayerSDK",children:[L.jsx(D.h,{customTheme:null!=o?o:m.theme,themeMode:m.themeMode,children:L.jsx(gy,{sdk:p,sidebar:n,banner:i,isMobileScreen:r,persistent:s,notification:u,skipTypeCheck:l,skipAutoClose:a,layoutMode:"side-by-side",externalAd:c,muted:h})}),void 0!==t&&L.jsx(V.j,{event:t})]}):void 0!==t&&L.jsx(V.j,{event:t}):null},exports.StreamLayerSDKAdvertisementUI=gy;