@streamlayer/react 1.14.8 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/advertisement.js +2 -2
- package/lib/cjs/bet-pack.js +1 -1
- package/lib/cjs/index2.js +3 -3
- package/lib/cjs/masters2.js +2 -2
- package/lib/cjs/notification.js +1 -1
- package/lib/cjs/points.js +1 -1
- package/lib/cjs/provider.js +13 -13
- package/lib/cjs/useStreamLayerApp2.js +5 -5
- package/lib/classic/cjs/advertisement.js +2 -2
- package/lib/classic/cjs/bet-pack.js +1 -1
- package/lib/classic/cjs/index2.js +3 -3
- package/lib/classic/cjs/masters2.js +2 -2
- package/lib/classic/cjs/notification.js +1 -1
- package/lib/classic/cjs/points.js +1 -1
- package/lib/classic/cjs/provider.js +10 -10
- package/lib/classic/cjs/useStreamLayerApp2.js +5 -5
- package/lib/classic/es/advertisement.js +5 -5
- package/lib/classic/es/bet-pack.js +20 -11
- package/lib/classic/es/index2.js +198 -194
- package/lib/classic/es/masters2.js +18 -18
- package/lib/classic/es/notification.js +49 -48
- package/lib/classic/es/points.js +18 -12
- package/lib/classic/es/provider.js +404 -389
- package/lib/classic/es/useStreamLayerApp2.js +252 -250
- package/lib/classic/style.css +1 -1
- package/lib/dist/cjs/gamification-feature2.js +1 -1
- package/lib/dist/cjs/masters.js +31 -31
- package/lib/dist/es/gamification-feature2.js +91 -89
- package/lib/dist/es/masters.js +4530 -4504
- package/lib/dist/style.css +1 -1
- package/lib/es/advertisement.js +5 -5
- package/lib/es/bet-pack.js +20 -11
- package/lib/es/index2.js +198 -194
- package/lib/es/masters2.js +18 -18
- package/lib/es/notification.js +49 -48
- package/lib/es/points.js +18 -12
- package/lib/es/provider.js +404 -389
- package/lib/es/useStreamLayerApp2.js +252 -250
- package/lib/style.css +1 -1
- package/package.json +14 -14
package/lib/cjs/advertisement.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react/jsx-runtime"),Me=require("react"),X=require("./provider.js"),ge=require("./useStreamLayerApp2.js"),g_=/^(?:[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 mh(i){return typeof i=="string"&&g_.test(i)}function gc(i){if(!mh(i))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(i.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(i.slice(9,13),16))>>>8,e&255,(e=parseInt(i.slice(14,18),16))>>>8,e&255,(e=parseInt(i.slice(19,23),16))>>>8,e&255,(e=parseInt(i.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}function m_(i){i=unescape(encodeURIComponent(i));const e=new Uint8Array(i.length);for(let t=0;t<i.length;++t)e[t]=i.charCodeAt(t);return e}const f_="6ba7b810-9dad-11d1-80b4-00c04fd430c8",y_="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function __(i,e,t,r,n,s){const a=typeof t=="string"?m_(t):t,l=typeof r=="string"?gc(r):r;if(typeof r=="string"&&(r=gc(r)),(r==null?void 0:r.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);if(u.set(l),u.set(a,l.length),u=e(u),u[6]=u[6]&15|i,u[8]=u[8]&63|128,n){s=s||0;for(let p=0;p<16;++p)n[s+p]=u[p];return n}return ge.unsafeStringify(u)}function b_(i,e,t,r){switch(i){case 0:return e&t^~e&r;case 1:return e^t^r;case 2:return e&t^e&r^t&r;case 3:return e^t^r}}function _o(i,e){return i<<e|i>>>32-e}function v_(i){const e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(i.length+1);r.set(i),r[i.length]=128,i=r;const n=i.length/4+2,s=Math.ceil(n/16),a=new Array(s);for(let l=0;l<s;++l){const u=new Uint32Array(16);for(let p=0;p<16;++p)u[p]=i[l*64+p*4]<<24|i[l*64+p*4+1]<<16|i[l*64+p*4+2]<<8|i[l*64+p*4+3];a[l]=u}a[s-1][14]=(i.length-1)*8/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=(i.length-1)*8&4294967295;for(let l=0;l<s;++l){const u=new Uint32Array(80);for(let C=0;C<16;++C)u[C]=a[l][C];for(let C=16;C<80;++C)u[C]=_o(u[C-3]^u[C-8]^u[C-14]^u[C-16],1);let p=t[0],g=t[1],b=t[2],S=t[3],w=t[4];for(let C=0;C<80;++C){const v=Math.floor(C/20),D=_o(p,5)+b_(v,g,b,S)+w+e[v]+u[C]>>>0;w=S,S=b,b=_o(g,30)>>>0,g=p,p=D}t[0]=t[0]+p>>>0,t[1]=t[1]+g>>>0,t[2]=t[2]+b>>>0,t[3]=t[3]+S>>>0,t[4]=t[4]+w>>>0}return Uint8Array.of(t[0]>>24,t[0]>>16,t[0]>>8,t[0],t[1]>>24,t[1]>>16,t[1]>>8,t[1],t[2]>>24,t[2]>>16,t[2]>>8,t[2],t[3]>>24,t[3]>>16,t[3]>>8,t[3],t[4]>>24,t[4]>>16,t[4]>>8,t[4])}function Hs(i,e,t,r){return __(80,v_,i,e,t,r)}Hs.DNS=f_;Hs.URL=y_;const T_=X.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),S_="a1rlj479",E_="s35f1di",w_="sj4471g",k_="b12050d8",C_="b1d5ybek",I_=i=>i==="left"||i==="right"?E_:k_,A_=i=>i==="left"||i==="right"?w_:C_,x_=i=>i==="left"?"avdxyl3":i==="right"?"a1bisd08":i==="top"?"a1u9y2aj":"a1qqaks",bl=({children:i,style:e,className:t,enabled:r=!0,hiding:n,direction:s="left",onAnimationEnd:a})=>W.jsx(T_,{style:e,className:X.cx_default(t,S_,x_(s),r&&!n&&I_(s),r&&n&&A_(s)),onAnimationEnd:a,children:i}),L_=X.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),D_=X.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),P_=()=>L_,R_=X.styled_default(P_())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),N_=({promotion:i,promotionId:e,hiding:t,direction:r="bottom"})=>{var n,s;if(!((n=i.additionalBanner)!=null&&n.imageUrl))return null;let a=(s=i.additionalBanner)==null?void 0:s.url;return a&&a.indexOf("http")!==0&&(a=`https://${a}`),W.jsx(bl,{direction:r,hiding:t,children:W.jsx(D_,{className:"BannerContainer",children:W.jsx(R_,{as:a?"a":"span",className:"BannerLink",href:a,style:{backgroundImage:`url(${i.additionalBanner.imageUrl})`,cursor:a?"pointer":"default"},"data-promo-id":e,"data-promo-type":i.type,"data-analytics":"banner",target:"_blank"})})})},O_=X.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),U_=X.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),M_=X.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),B_=X.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),vl=X.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),F_=()=>vl,j_=X.styled_default(F_())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),q_=X.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),$_=X.styled_default("button")({name:"Button",class:"bgl6boa",propsAsIs:!1}),V_=X.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),H_=X.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),z_=X.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),W_=X.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),G_={[ge.NotificationPromotionImagePosition.BOTTOM]:vl,[ge.NotificationPromotionImagePosition.MIDDLE]:j_},X_=({src:i,imagePosition:e})=>{const t=G_[e]||vl;return W.jsx(t,{children:W.jsx("img",{src:i,alt:""})})},K_=({notification:i,open:e})=>{if(!i||!i.promotion||i.enabled!==ge.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:t,body:r,image:n,promotion:s}=i,{sponsorLogo:a,sponsorLogoMode:l,imagePosition:u,ctaButton:p}=s;return W.jsxs(W_,{className:"SL_Lower_Third_Notification",onClick:e,children:[W.jsxs(O_,{children:[W.jsx(X_,{src:n,imagePosition:u}),W.jsxs(U_,{children:[t&&W.jsx(M_,{children:t}),r&&W.jsx(B_,{children:r})]})]}),W.jsxs(H_,{children:[l!==ge.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&W.jsxs(W.Fragment,{children:[W.jsx(V_,{children:W.jsx("img",{src:a,alt:t})}),W.jsx(z_,{})]}),W.jsxs($_,{name:"promo-button",style:{color:p==null?void 0:p.textColor,backgroundColor:p==null?void 0:p.color},children:[(p==null?void 0:p.ctaIcon)&&(p==null?void 0:p.ctaIconMode)===ge.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(q_,{src:p==null?void 0:p.ctaIcon,alt:"cta-icon"}),(p==null?void 0:p.label)||"Open"]})]})]})},Y_=X.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),Q_=X.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),J_=X.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),Z_=X.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),e0=X.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),va=X.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),t0=()=>va,mc=X.styled_default(t0())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),i0=()=>va,fh=X.styled_default(i0())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),r0=()=>fh,n0=X.styled_default(r0())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),s0=()=>va,a0=X.styled_default(s0())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),o0=()=>va,l0=X.styled_default(o0())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),u0=X.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),c0=X.styled_default("button")({name:"Button",class:"bis90pl",propsAsIs:!1}),d0=()=>X.k1,h0=X.styled_default(d0())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),p0=X.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),g0={[ge.NotificationPromotionImagePosition.UNSET]:mc,[ge.NotificationPromotionImagePosition.FIT]:mc,[ge.NotificationPromotionImagePosition.CENTERED]:fh,[ge.NotificationPromotionImagePosition.BOTTOM]:n0,[ge.NotificationPromotionImagePosition.SOLID]:a0,[ge.NotificationPromotionImagePosition.MIDDLE]:l0},m0=({src:i,imagePosition:e})=>{const t=g0[e];return W.jsx(t,{children:W.jsx("img",{src:i,alt:""})})},f0=({notification:i,open:e,promotionId:t,hiding:r,direction:n="left"})=>{if(!i||!i.promotion||i.enabled!==ge.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(i.promotion.mode===ge.NotificationPromotionMode.LOWER_THIRD)return W.jsx(K_,{notification:i,open:e});const{title:s,body:a,image:l,promotion:u}=i,{sponsorLogo:p,sponsorLogoMode:g,imagePosition:b,ctaButton:S}=u;return W.jsx(bl,{className:"SL_Rich_Notification",direction:n,hiding:r,children:W.jsxs(Q_,{onClick:e,children:[g!==ge.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&p&&W.jsx(p0,{children:W.jsx("img",{src:p,alt:s})}),W.jsxs(Y_,{children:[W.jsx(m0,{src:l,imagePosition:b}),W.jsxs(J_,{children:[s&&W.jsx(Z_,{children:s}),a&&W.jsx(e0,{children:a})]}),W.jsxs(c0,{name:"promo-button",style:{color:S==null?void 0:S.textColor,backgroundColor:S==null?void 0:S.color},children:[(S==null?void 0:S.ctaIcon)&&(S==null?void 0:S.ctaIconMode)===ge.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(u0,{src:S==null?void 0:S.ctaIcon,alt:"cta-icon"}),(S==null?void 0:S.label)||"Open"]}),W.jsx(h0,{name:"chevronRight"})]})]})})},y0=X.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),yh=X.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),_h=X.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),bh=X.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),vh="h10toh7",fc=X.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),_0=X.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),Th=X.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),b0=X.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),v0="s1nmch9k",yc=X.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),T0=X.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),S0=X.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),E0=X.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),Sh=X.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),w0=X.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),Eh=X.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),wh=X.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),k0=X.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),C0="h17rwbtk",I0=X.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),_c=X.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),A0=X.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),x0=({time:i,adCount:e,adPosition:t})=>{const r=Math.floor(i/60),n=i-r*60;return r===0&&n===0&&e===t?null:W.jsxs(I0,{children:[e>1&&W.jsxs(W.Fragment,{children:[W.jsxs(_c,{children:[t," of ",e]}),W.jsx(A0,{})]}),W.jsxs(_c,{children:[r,":",n<10?`0${n}`:n]})]})},L0=X.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),D0=({whyThisAd:i})=>{const[e,t]=Me.useState(!1);return!i.iconClickThroughURLTemplate||!i.staticResource?null:W.jsxs(L0,{style:{width:i.width,height:i.height,[i.xPosition]:3,[i.yPosition]:11},href:i.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!e&&W.jsx("img",{alt:"ad choice",src:i.staticResource,onLoad:()=>t(!1),onError:()=>t(!0)}),e&&W.jsx("span",{children:"ad choice"})]})},P0=X.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),kh=X.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),R0=()=>kh,N0=X.styled_default(R0())({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),O0=()=>kh,U0=X.styled_default(O0())({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),M0=X.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),B0=X.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),bc="m12n261r",vc="m16vcml8",Tc="m1078nk6",Sc=globalThis||void 0||self;function Tl(){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 F0=["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 Ec(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=[],n=Ih(i);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=Lh(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const s in e)e[s]=xh(e[s]);for(const s in n){const a=n[s];typeof a=="string"&&r.push(Ch(a,e))}return r}function Ch(i,e){const t=(i=wc(i,e)).match(/[^[\]]+(?=])/g);if(!t)return i;let r=t.filter(n=>F0.indexOf(n)>-1);return r.length===0?i:(r=r.reduce((n,s)=>(n[s]=-1,n),{}),wc(i,r))}function wc(i,e){let t=i;for(const r in e){const n=e[r];t=t.replace(new RegExp("(?:\\[|%%)(".concat(r,")(?:\\]|%%)"),"g"),n)}return t}function Ih(i){return Array.isArray(i)?i.map(e=>e&&e.hasOwnProperty("url")?e.url:e):i}function kc(i){return/^(https?:\/\/|\/\/)/.test(i)}function Cc(i,e){for(let t=0;t<e.length;t++)if(Ah(e[t],i))return!0;return!1}function Ah(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 xh(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function Lh(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;return i.toString().padStart(e,"0")}const Ee={track:function(i,e,t){Ec(i,e,t).forEach(r=>{typeof window<"u"&&window!==null&&(new Image().src=r)})},resolveURLTemplates:Ec,extractURLsFromTemplates:Ih,filterUrlTemplates:function(i){return i.reduce((e,t)=>{const r=t.url||t;return kc(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:Cc,isTemplateObjectEqual:Ah,encodeURIComponentRFC3986:xh,replaceUrlMacros:Ch,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((n,s)=>(Cc(s,n)||n.push(s),n),[])},isValidTimeValue:function(i){return Number.isFinite(i)&&i>=-2},addLeadingZeros:Lh,isValidUrl:kc,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 j0(i){if(i==null)return-1;if(Ee.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 n=parseInt(60*e[1]),s=parseInt(60*e[0]*60);return isNaN(s)||isNaN(n)||isNaN(r)||n>3600||r>60?-1:s+n+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:j0,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:n}=t;if(r&&n&&e.hasOwnProperty(r)){let s=n;typeof e[r]=="boolean"&&(s=Ic(s)),e[r]=s}})},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"),n=r.reduce((l,u)=>((u.variations||[]).forEach(p=>{(p.companionClickTrackingURLTemplates||[]).forEach(g=>{Ee.containsTemplateObject(g,l)||l.push(g)})}),l),[]);i.creatives=r.concat(i.creatives);const s=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 p=e.trackingEvents[l.type][u];Array.isArray(l.trackingEvents[u])||(l.trackingEvents[u]=[]),l.trackingEvents[u]=l.trackingEvents[u].concat(p)}l.type==="linear"&&(s&&(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"&&n.length&&(l.variations||[]).forEach(u=>{u.companionClickTrackingURLTemplates=Ee.joinArrayOfUniqueTemplateObjs(u.companionClickTrackingURLTemplates,n)})}),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 p;return((p=u.icons)===null||p===void 0?void 0:p.length)&&!u.mediaFiles.length});l.length&&(i.creatives=i.creatives.concat(l))}}};function q0(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:n,adId:s,sequence:a,apiFramework:l}=Tl(r);return{id:n,adId:s,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 n=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));n.htmlResources=j.childrenByName(r,"HTMLResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat(p):l},[]),n.iframeResources=j.childrenByName(r,"IFrameResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat(p):l},[]),n.staticResources=j.childrenByName(r,"StaticResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat({url:p,creativeType:u.getAttribute("creativeType")||null}):l},[]),n.altText=j.parseNodeText(j.childByName(r,"AltText"))||null;const s=j.childByName(r,"TrackingEvents");s&&j.childrenByName(s,"Tracking").forEach(l=>{const u=l.getAttribute("event"),p=j.parseNodeText(l);u&&p&&(Array.isArray(n.trackingEvents[u])||(n.trackingEvents[u]=[]),n.trackingEvents[u].push(p))}),n.companionClickTrackingURLTemplates=j.childrenByName(r,"CompanionClickTracking").map(l=>({id:l.getAttribute("id")||null,url:j.parseNodeText(l)})),n.companionClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"CompanionClickThrough"))||null;const a=j.childByName(r,"AdParameters");return a&&(n.adParameters={value:j.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),n}),t}function $0(i,e){let t;const r=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:p,adId:g,sequence:b,apiFramework:S}=Tl(u);return{id:p,adId:g,sequence:b,apiFramework:S,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 n=i.getAttribute("skipoffset");if(n==null)r.skipDelay=null;else if(n.charAt(n.length-1)==="%"&&r.duration!==-1){const u=parseInt(n,10);r.skipDelay=r.duration*(u/100)}else r.skipDelay=j.parseDuration(n);const s=j.childByName(i,"VideoClicks");if(s){const u=j.childByName(s,"ClickThrough");r.videoClickThroughURLTemplate=u?{id:u.getAttribute("id")||null,url:j.parseNodeText(u)}:null,j.childrenByName(s,"ClickTracking").forEach(p=>{r.videoClickTrackingURLTemplates.push({id:p.getAttribute("id")||null,url:j.parseNodeText(p)})}),j.childrenByName(s,"CustomClick").forEach(p=>{r.videoCustomClickURLTemplates.push({id:p.getAttribute("id")||null,url:j.parseNodeText(p)})})}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(p=>{let g=p.getAttribute("event");const b=j.parseNodeText(p);if(g&&b){if(g==="progress"){if(t=p.getAttribute("offset"),!t)return;g=t.charAt(t.length-1)==="%"?"progress-".concat(t):"progress-".concat(j.parseDuration(t))}Array.isArray(r.trackingEvents[g])||(r.trackingEvents[g]=[]),r.trackingEvents[g].push(b)}})}),j.childrenByName(i,"MediaFiles").forEach(u=>{j.childrenByName(u,"MediaFile").forEach(w=>{r.mediaFiles.push(function(C){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=C.getAttribute("id"),v.fileURL=j.parseNodeText(C),v.deliveryType=C.getAttribute("delivery"),v.codec=C.getAttribute("codec"),v.mimeType=C.getAttribute("type"),v.mediaType=C.getAttribute("mediaType")||"2D",v.apiFramework=C.getAttribute("apiFramework"),v.fileSize=parseInt(C.getAttribute("fileSize")||0),v.bitrate=parseInt(C.getAttribute("bitrate")||0),v.minBitrate=parseInt(C.getAttribute("minBitrate")||0),v.maxBitrate=parseInt(C.getAttribute("maxBitrate")||0),v.width=parseInt(C.getAttribute("width")||0),v.height=parseInt(C.getAttribute("height")||0);const D=C.getAttribute("scalable");D&&typeof D=="string"&&(v.scalable=j.parseBoolean(D));const L=C.getAttribute("maintainAspectRatio");return L&&typeof L=="string"&&(v.maintainAspectRatio=j.parseBoolean(L)),v}(w))});const p=j.childByName(u,"InteractiveCreativeFile");p&&(r.interactiveCreativeFile=function(w){const C=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(w));return C.fileURL=j.parseNodeText(w),C}(p));const g=j.childByName(u,"ClosedCaptionFiles");g&&j.childrenByName(g,"ClosedCaptionFile").forEach(w=>{const C=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(w));C.fileURL=j.parseNodeText(w),r.closedCaptionFiles.push(C)});const b=j.childByName(u,"Mezzanine"),S=function(w,C){const v={};let D=!1;return C.forEach(L=>{w&&w.getAttribute(L)?v[L]=w.getAttribute(L):D=!0}),D?null:v}(b,["delivery","type","width","height"]);if(S){const w={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};w.id=b.getAttribute("id"),w.fileURL=j.parseNodeText(b),w.delivery=S.delivery,w.codec=b.getAttribute("codec"),w.type=S.type,w.width=parseInt(S.width,10),w.height=parseInt(S.height,10),w.fileSize=parseInt(b.getAttribute("fileSize"),10),w.mediaType=b.getAttribute("mediaType")||"2D",r.mezzanine=w}});const l=j.childByName(i,"Icons");return l&&j.childrenByName(l,"Icon").forEach(u=>{r.icons.push(function(p){const g={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:[]};g.program=p.getAttribute("program"),g.height=parseInt(p.getAttribute("height")||0),g.width=parseInt(p.getAttribute("width")||0),g.xPosition=function(S){return["left","right"].indexOf(S)!==-1?S:parseInt(S||0)}(p.getAttribute("xPosition")),g.yPosition=function(S){return["top","bottom"].indexOf(S)!==-1?S:parseInt(S||0)}(p.getAttribute("yPosition")),g.apiFramework=p.getAttribute("apiFramework"),g.pxratio=p.getAttribute("pxratio")||"1",g.offset=j.parseDuration(p.getAttribute("offset")),g.duration=j.parseDuration(p.getAttribute("duration")),j.childrenByName(p,"HTMLResource").forEach(S=>{g.type=S.getAttribute("creativeType")||"text/html",g.htmlResource=j.parseNodeText(S)}),j.childrenByName(p,"IFrameResource").forEach(S=>{g.type=S.getAttribute("creativeType")||0,g.iframeResource=j.parseNodeText(S)}),j.childrenByName(p,"StaticResource").forEach(S=>{g.type=S.getAttribute("creativeType")||0,g.staticResource=j.parseNodeText(S)});const b=j.childByName(p,"IconClicks");if(b){g.iconClickThroughURLTemplate=j.parseNodeText(j.childByName(b,"IconClickThrough")),j.childrenByName(b,"IconClickTracking").forEach(w=>{g.iconClickTrackingURLTemplates.push({id:w.getAttribute("id")||null,url:j.parseNodeText(w)})});const S=j.childByName(b,"IconClickFallbackImages");S&&j.childrenByName(S,"IconClickFallbackImage").forEach(w=>{g.iconClickFallbackImages.push({url:j.parseNodeText(w)||null,width:w.getAttribute("width")||null,height:w.getAttribute("height")||null})})}return g.iconViewTrackingURLTemplate=j.parseNodeText(j.childByName(p,"IconViewTracking")),g}(u))}),r}function V0(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:n,adId:s,sequence:a,apiFramework:l}=Tl(r);return{id:n,adId:s,sequence:a,apiFramework:l,type:"nonlinear",variations:[],trackingEvents:{}}}(e);return j.childrenByName(i,"TrackingEvents").forEach(r=>{let n,s;j.childrenByName(r,"Tracking").forEach(a=>{n=a.getAttribute("event"),s=j.parseNodeText(a),n&&s&&(Array.isArray(t.trackingEvents[n])||(t.trackingEvents[n]=[]),t.trackingEvents[n].push(s))})}),j.childrenByName(i,"NonLinear").forEach(r=>{const n={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};n.id=r.getAttribute("id")||null,n.width=r.getAttribute("width"),n.height=r.getAttribute("height"),n.expandedWidth=r.getAttribute("expandedWidth"),n.expandedHeight=r.getAttribute("expandedHeight"),n.scalable=j.parseBoolean(r.getAttribute("scalable")),n.maintainAspectRatio=j.parseBoolean(r.getAttribute("maintainAspectRatio")),n.minSuggestedDuration=j.parseDuration(r.getAttribute("minSuggestedDuration")),n.apiFramework=r.getAttribute("apiFramework"),j.childrenByName(r,"HTMLResource").forEach(a=>{n.type=a.getAttribute("creativeType")||"text/html",n.htmlResource=j.parseNodeText(a)}),j.childrenByName(r,"IFrameResource").forEach(a=>{n.type=a.getAttribute("creativeType")||0,n.iframeResource=j.parseNodeText(a)}),j.childrenByName(r,"StaticResource").forEach(a=>{n.type=a.getAttribute("creativeType")||0,n.staticResource=j.parseNodeText(a)});const s=j.childByName(r,"AdParameters");s&&(n.adParameters={value:j.parseNodeText(s),xmlEncoded:s.getAttribute("xmlEncoded")||null}),n.nonlinearClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"NonLinearClickThrough")),j.childrenByName(r,"NonLinearClickTracking").forEach(a=>{n.nonlinearClickTrackingURLTemplates.push({id:a.getAttribute("id")||null,url:j.parseNodeText(a)})}),t.variations.push(n)}),t}function Ac(i){const e=[];return i.forEach(t=>{const r=Dh(t);r&&e.push(r)}),e}function Dh(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 s in t)if(t.hasOwnProperty(s)){const a=t[s];a.nodeName&&a.nodeValue&&(e.attributes[a.nodeName]=a.nodeValue)}}for(const s in r)if(r.hasOwnProperty(s)){const a=Dh(r[s]);a&&e.children.push(a)}if(e.children.length===0||e.children.length===1&&["#cdata-section","#text"].indexOf(e.children[0].name)>=0){const s=j.parseNodeText(i);s!==""&&(e.value=s),e.children=[]}return(n=e).value===null&&Object.keys(n.attributes).length===0&&n.children.length===0?null:e;var n}function H0(i){return i.getAttribute("AdID")||i.getAttribute("adID")||i.getAttribute("adId")||null}const js={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 xc(i,e){if(!js[i.nodeName]||!js[i.nodeName].attributes)return;const t=js[i.nodeName].attributes.filter(r=>!i.getAttribute(r));t.length>0&&Mn({name:i.nodeName,parentName:i.parentNode.nodeName,attributes:t},e)}function Lc(i,e,t){const r=js[i.nodeName],n=!t&&i.nodeName!=="Wrapper";if(!(!r||n)){if(r.subElements){const s=r.subElements.filter(a=>!j.childByName(i,a));s.length>0&&Mn({name:i.nodeName,parentName:i.parentNode.nodeName,subElements:s},e)}!t||!r.oneOfinLineResources||r.oneOfinLineResources.some(s=>j.childByName(i,s))||Mn({name:i.nodeName,parentName:i.parentNode.nodeName,oneOfResources:r.oneOfinLineResources},e)}}function Dc(i){return i.children&&i.children.length!==0}function Mn(i,e){let{name:t,parentName:r,attributes:n,subElements:s,oneOfResources:a}=i,l="Element '".concat(t,"'");l+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):s?" missing required sub element(s) '".concat(s.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",e("VAST-warning",{message:l,parentElement:r,specVersion:4.1})}const z0={verifyRequiredValues:function i(e,t,r){if(e&&e.nodeName)if(e.nodeName==="InLine"&&(r=!0),xc(e,t),Dc(e)){Lc(e,t,r);for(let n=0;n<e.children.length;n++)i(e.children[n],t,r)}else j.parseNodeText(e).length===0&&Mn({name:e.nodeName,parentName:e.parentNode.nodeName},t)},hasSubElements:Dc,emitMissingValueWarning:Mn,verifyRequiredAttributes:xc,verifyRequiredSubElements:Lc};function W0(i,e){let{allowMultipleAds:t,followAdditionalWrappers:r}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=Array.from(i.childNodes).filter(s=>{const a=s.nodeName.toLowerCase();return a==="inline"||r!==!1&&a==="wrapper"});for(const s of n){if(j.copyNodeAttribute("id",i,s),j.copyNodeAttribute("sequence",i,s),j.copyNodeAttribute("adType",i,s),s.nodeName==="Wrapper")return{ad:X0(s,e),type:"WRAPPER"};if(s.nodeName==="InLine")return{ad:G0(s,e,{allowMultipleAds:t}),type:"INLINE"};const a=s.nodeName.toLowerCase();e("VAST-warning",{message:"<".concat(s.nodeName,a==="inline"?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:s})}}function G0(i,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&i.getAttribute("sequence")?null:Ph(i,e)}function Ph(i,e){let t=[];e&&z0.verifyRequiredValues(i,e);const r=Array.from(i.childNodes),n=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:s.id||null,sequence:s.sequence||null,adType:s.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(s=>{switch(s.nodeName){case"Error":n.errorURLTemplates.push(j.parseNodeText(s));break;case"Impression":n.impressionURLTemplates.push({id:s.getAttribute("id")||null,url:j.parseNodeText(s)});break;case"Creatives":n.creatives=function(a){const l=[];return a.forEach(u=>{const p={id:u.getAttribute("id")||null,adId:H0(u),sequence:u.getAttribute("sequence")||null,apiFramework:u.getAttribute("apiFramework")||null},g=[];let b;j.childrenByName(u,"UniversalAdId").forEach(w=>{const C={idRegistry:w.getAttribute("idRegistry")||"unknown",value:j.parseNodeText(w)};g.push(C)});const S=j.childByName(u,"CreativeExtensions");S&&(b=Ac(j.childrenByName(S,"CreativeExtension")));for(const w in u.childNodes){const C=u.childNodes[w];let v;switch(C.nodeName){case"Linear":v=$0(C,p);break;case"NonLinearAds":v=V0(C,p);break;case"CompanionAds":v=q0(C,p)}v&&(g&&(v.universalAdIds=g),b&&(v.creativeExtensions=b),l.push(v))}}),l}(j.childrenByName(s,"Creative"));break;case"Extensions":{const a=j.childrenByName(s,"Extension");n.extensions=Ac(a),n.adVerifications.length||(t=function(l){let u=null,p=[];return l.some(g=>u=j.childByName(g,"AdVerifications")),u&&(p=Pc(j.childrenByName(u,"Verification"))),p}(a));break}case"AdVerifications":n.adVerifications=Pc(j.childrenByName(s,"Verification"));break;case"AdSystem":n.system={value:j.parseNodeText(s),version:s.getAttribute("version")||null};break;case"AdTitle":n.title=j.parseNodeText(s);break;case"AdServingId":n.adServingId=j.parseNodeText(s);break;case"Category":n.categories.push({authority:s.getAttribute("authority")||null,value:j.parseNodeText(s)});break;case"Expires":n.expires=parseInt(j.parseNodeText(s),10);break;case"ViewableImpression":n.viewableImpression.push(function(a){const l=(u,p)=>{const g=j.parseNodeText(p);return g&&u.push(g),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,[])}}(s));break;case"Description":n.description=j.parseNodeText(s);break;case"Advertiser":n.advertiser={id:s.getAttribute("id")||null,value:j.parseNodeText(s)};break;case"Pricing":n.pricing={value:j.parseNodeText(s),model:s.getAttribute("model")||null,currency:s.getAttribute("currency")||null};break;case"Survey":n.survey={value:j.parseNodeText(s),type:s.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:s.getAttribute("authority")||null,value:j.parseNodeText(s)})}}),t.length&&(n.adVerifications=n.adVerifications.concat(t)),n}function X0(i,e){const t=Ph(i,e),r=i.getAttribute("followAdditionalWrappers"),n=i.getAttribute("allowMultipleAds"),s=i.getAttribute("fallbackOnNoAd");t.followAdditionalWrappers=!r||j.parseBoolean(r),t.allowMultipleAds=!!n&&j.parseBoolean(n),t.fallbackOnNoAd=s?j.parseBoolean(s):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 p=l.trackingEvents[u];Array.isArray(t.trackingEvents[l.type][u])||(t.trackingEvents[l.type][u]=[]),p.forEach(g=>{t.trackingEvents[l.type][u].push(g)})}}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 Pc(i){const e=[];return i.forEach(t=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},n=Array.from(t.childNodes);j.assignAttributes(t.attributes,r),n.forEach(a=>{let{nodeName:l,textContent:u,attributes:p}=a;switch(l){case"JavaScriptResource":case"ExecutableResource":r.resource=u.trim(),j.assignAttributes(p,r);break;case"VerificationParameters":r.parameters=u.trim()}});const s=j.childByName(t,"TrackingEvents");s&&j.childrenByName(s,"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}let Rh=class{constructor(){this._handlers=[]}on(e,t){if(typeof t!="function")throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(r,n,s){const a={fired:!1,wrapFn:void 0};function l(){a.fired||(r.off(n,a.wrapFn),a.fired=!0,s.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),n=1;n<t;n++)r[n-1]=arguments[n];let s=!1;return this._handlers.forEach(a=>{a.event==="*"&&(s=!0,a.handler(e,...r)),a.event===e&&(s=!0,a.handler(...r))}),s}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)}},Rc=0,$o=0;const Nh=(i,e)=>{!i||!e||i<=0||e<=0||($o=($o*Rc+8*i/e)/++Rc)},K0={ERRORCODE:900,extensions:[]},Nc="VAST response version not supported";let Y0=class extends Rh{constructor(){let{fetcher:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null}trackVastError(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];this.emit("VAST-error",Object.assign({},K0,t,...n)),Ee.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return $o}initParsingStatus(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.rootURL="",this.resetParsingStatus(),Nh(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:n,errorURLTemplates:s,version:a}=r;return{ads:n||[],errorURLTemplates:s||[],version:a||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:n=null,wrapperDepth:s=0,allowMultipleAds:a,followAdditionalWrappers:l}=t;if(!e||!e.documentElement||e.documentElement.nodeName!=="VAST"){var u;this.emit("VAST-ad-parsed",{type:"ERROR",url:n,wrapperDepth:s});const S=(e==null||(u=e.documentElement)===null||u===void 0?void 0:u.nodeName)==="VideoAdServingTemplate";throw new Error(S?Nc:"Invalid VAST XMLDocument")}const p=[],g=e.documentElement.childNodes,b=e.documentElement.getAttribute("version");r&&b&&(this.vastVersion=b);for(const S in g){const w=g[S];if(w.nodeName==="Error"){const C=j.parseNodeText(w);r?this.rootErrorURLTemplates.push(C):this.errorURLTemplates.push(C)}else if(w.nodeName==="Ad"){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(a===!1&&p.length>1)break;const C=W0(w,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:l});C.ad?(p.push(C.ad),this.emit("VAST-ad-parsed",{type:C.type,url:n,wrapperDepth:s,adIndex:p.length-1,vastVersion:b})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return p}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:n=null,previousUrl:s=null,wrapperDepth:a=0,isRootVAST:l=!1,followAdditionalWrappers:u,allowMultipleAds:p}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&l&&(p=!0);try{g=this.parseVastXml(e,{isRootVAST:l,url:t,wrapperDepth:a,allowMultipleAds:p,followAdditionalWrappers:u})}catch(b){return Promise.reject(b)}if(g.length===1&&n!=null&&(g[0].sequence=n),r===!1){const b=j.getSortedAdPods(g),S=j.getStandAloneAds(g);b.length?g=b:S.length&&(g=[S.shift()]),this.remainingAds=S}return this.resolveAds(g,{wrapperDepth:a,previousUrl:s,url:t})}resolveAds(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:n}=arguments.length>1?arguments[1]:void 0;const s=[];return r=n,e.forEach(a=>{const l=this.resolveWrappers(a,t,r);s.push(l)}),Promise.all(s).then(a=>Ee.flatten(a))}resolveWrappers(e,t,r){const n={...e};return new Promise(s=>{var a;if(t++,!n.nextWrapperURL)return delete n.nextWrapperURL,s(n);if(!this.fetcher)return n.VASTAdTagURI=n.nextWrapperURL,delete n.nextWrapperURL,s(n);if(t>=this.maxWrapperDepth)return n.errorCode=302,delete n.nextWrapperURL,s(n);n.nextWrapperURL=j.resolveVastAdTagURI(n.nextWrapperURL,r);const l=(a=this.parsingOptions.allowMultipleAds)!==null&&a!==void 0?a:n.allowMultipleAds,u=n.sequence;this.fetcher.fetchVAST({url:n.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(p=>this.parse(p,{url:n.nextWrapperURL,previousUrl:r,wrapperSequence:u,wrapperDepth:t,followAdditionalWrappers:n.followAdditionalWrappers,allowMultipleAds:l}).then(g=>{if(delete n.nextWrapperURL,g.length===0)return n.creatives=[],s(n);g.forEach(b=>{b&&j.mergeWrapperAdData(b,n)}),s(g)})).catch(p=>{n.errorCode=p.message===Nc?102:301,n.errorMessage=p.message,s(n)})})}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],n=!r.creatives.some(s=>{var a;return((a=s.mediaFiles)===null||a===void 0?void 0:a.length)>0});!r.errorCode&&!n||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),e.ads.splice(t,1))}}},di=null;const Q0={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 J0{constructor(){this.storage=this.initStorage()}initStorage(){if(di)return di;try{di=typeof window<"u"&&window!==null?window.localStorage||window.sessionStorage:null}catch{di=null}return di&&!this.isStorageDisabled(di)||(di=Q0,di.clear()),di}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 Vo=12e4,Z0={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||Vo," ms (408)"))},e.timeout||Vo),n=await fetch(i,{...e,signal:t.signal,credentials:e.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(r)}),s=function(a){return Ee.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,")")}(n);return s?{error:new Error(s),statusCode:n.status}:async function(a){const l=await a.text();let u;return u=Ee.isBrowserEnvironment()?new DOMParser:new(await Promise.resolve().then(()=>jb).then(p=>p.i)).DOMParser,{xml:u.parseFromString(l,"text/xml"),details:{byteLength:l.length,statusCode:a.status,rawXml:l}}}(n)}catch(t){return{error:t,statusCode:t.name==="AbortError"?408:null}}}};let eb=class{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||Z0,this.fetchingOptions={timeout:e.timeout||Vo,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:n,emitter:s,wrapperDepth:a=0,previousUrl:l=null,wrapperAd:u=null}=e;const p=Date.now();this.URLTemplateFilters.forEach(S=>{r=S(r)}),s("VAST-resolving",{url:r,previousUrl:l,wrapperDepth:a,maxWrapperDepth:n,timeout:this.fetchingOptions.timeout,wrapperAd:u});const g=await this.urlHandler.get(r,this.fetchingOptions),b=Math.round(Date.now()-p);if(s("VAST-resolved",{url:r,previousUrl:l,wrapperDepth:a,error:(g==null?void 0:g.error)||null,duration:b,statusCode:(g==null?void 0:g.statusCode)||null,...g==null?void 0:g.details}),Nh(g==null||(t=g.details)===null||t===void 0?void 0:t.byteLength,b),g.error)throw new Error(g.error);return g.xml}},tb=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 J0;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new eb,this.vastParser=new Y0({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((n,s)=>{if(this.cappingFreeLunch>=this.totalCalls)return s(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 s(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 p=this.vastParser.buildVASTResponse(u);n(p)}))).catch(l=>s(l))})}},ib=class extends Rh{constructor(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,s=arguments.length>4&&arguments[4]!==void 0&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=s,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const a in this.creative.trackingEvents){const l=this.creative.trackingEvents[a];this.trackingEvents[a]=l.slice(0)}(function(a){return a.type==="linear"})(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}this.variation.adType==="nonLinearAd"?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return e.adType==="companionAd"}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){Ee.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(!Ee.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(Ee.formatMacrosValues(t))});const n=this.skipDelay||-1;if(n===-1||this.skippable||(n>e?this.emit("skip-countdown",n-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const s=Math.round(e/this.assetDuration*100),a=[];if(e>0){a.push("start");for(let l=this.lastPercentage;l<s;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=s}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 n=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(n=!0),n}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(Ee.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(Ee.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(Ee.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(Ee.formatMacrosValues(t))})}setSkipDelay(e){Ee.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewable,e)}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.notViewable,e)}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewUndetermined,e)}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"&&typeof t=="boolean"?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(Ee.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(Ee.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(s=>s.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const n=r.trackingEvents;if(n&&n.verificationNotExecuted){const s=n.verificationNotExecuted;this.trackURLs(s,t),this.emit("verificationNotExecuted",{trackingURLTemplates:s})}}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(Ee.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(Ee.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,n={...t};if(r){this.progress&&(n.ADPLAYHEAD=this.progressFormatted());const s=Ee.resolveURLTemplates([r],n)[0];this.emit("clickthrough",s)}}trackProgressEvents(e,t,r){const n=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(s=>{let[a]=s;return a.startsWith("progress-")}).map(s=>{let[a,l]=s;return{name:a,time:parseFloat(a.split("-")[1]),urls:l}}).filter(s=>{let{time:a}=s;return a<=n&&a>this.progress}).forEach(s=>{let{name:a,urls:l}=s;!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 n=this.trackingEvents[e],s=this.emitAlwaysEvents.indexOf(e)>-1;n?(this.emit(e,{trackingURLTemplates:n}),this.trackURLs(n,t)):s&&this.emit(e,null),r&&(delete this.trackingEvents[e],s&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{validUrls:s,invalidUrls:a}=Ee.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(","))),Ee.track(s,l,n)}convertToTimecode(e){if(!Ee.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),n=Math.floor(t/6e4%60),s=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(Ee.addLeadingZeros(r,2),":").concat(Ee.addLeadingZeros(n,2),":").concat(Ee.addLeadingZeros(s,2),".").concat(Ee.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}},rb=class{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 Oh(i,e){const t=[];for(const r in i.childNodes){const n=i.childNodes[r];(n.nodeName===e||e===`vmap:${n.nodeName}`||n.nodeName===`vmap:${e}`)&&t.push(n)}return t}function nb(i){if(!i||!i.childNodes)return{};const e=i.childNodes,t=[];for(const n in e){const s=e[n];s.nodeName==="#cdata-section"&&t.push(s)}if(t&&t.length>0)try{return JSON.parse(t[0].data)}catch{}let r="";for(const n in e){const s=e[n];switch(s.nodeName){case"#text":r+=s.textContent.trim();break;case"#cdata-section":r+=s.data;break}}return r}function Sl(i){const e={attributes:{},children:{},value:{}};e.value=nb(i);const t=i.attributes;if(t)for(const n in t){const s=t[n];s.nodeName&&s.nodeValue!==void 0&&s.nodeValue!==null&&(e.attributes[s.nodeName]=s.nodeValue)}const r=i.childNodes;if(r)for(const n in r){const s=r[n];s.nodeName&&s.nodeName.substring(0,1)!=="#"&&(e.children[s.nodeName]=Sl(s))}return e}let sb=class{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 rb(r);break;case"TrackingEvents":for(const n in r.childNodes){const s=r.childNodes[n];s.localName==="Tracking"&&this.trackingEvents.push({event:s.getAttribute("event"),uri:(s.textContent||s.text||"").trim()})}break;case"Extensions":this.extensions=Oh(r,"Extension").map(n=>Sl(n));break}}}track(e,t){for(const r in this.trackingEvents){const n=this.trackingEvents[r];if(n.event===e){let{uri:s}=n;n.event==="error"&&(s=s.replace("[ERRORCODE]",t)),this.tracker(s)}}}tracker(e){if(typeof window<"u"&&window!==null){const t=new Image;t.src=e}}};class ab{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 sb(r));break;case"Extensions":this.extensions=Oh(r,"Extension").map(n=>Sl(n));break}}}}const ob=(i,e)=>{const t=goog.pal,r=new t.ConsentSettings;r.allowStorage=!1;const n=new t.NonceLoader(r);return async()=>{try{const s=new URL(e),a=new t.NonceRequest;let l=localStorage.getItem("sl-device-id")||ge.v4(),u=sessionStorage.getItem("sl-ad-session-id");u||(u=ge.v4(),sessionStorage.setItem("sl-ad-session-id",u)),mh(l)||(l=Hs(`https://${l}`,Hs.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"),a.adWillAutoPlay=s.searchParams.get("vpa")==="auto",a.adWillPlayMuted=s.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=s.searchParams.get("description_url"),a.iconsSupported=!0,a.sessionId=l,a.supportedApiFrameworks="2,7,9",a.videoHeight=i.clientHeight,a.videoWidth=i.clientWidth;const p=await n.loadNonceManager(a);return s.searchParams.get("is_lat")==="[placeholder]"&&s.searchParams.set("is_lat","1"),s.searchParams.get("rdid")==="[placeholder]"&&s.searchParams.set("rdid",l),s.searchParams.get("correlator")==="[placeholder]"&&s.searchParams.set("correlator",u),s.searchParams.set("wta","1"),s.searchParams.set("givn",p.getNonce()),s}catch(s){console.log("AdsManager could not be started",s);return}}},lb=new tb,ub=i=>i.creatives.find(e=>e.mediaFiles),cb=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)||""},Oc=X.a$1({ads:[],autoplay:!0,muted:!1}),db=(i,e)=>{const[t,r]=Me.useState(),n=Me.useRef(Date.now()),s=Me.useRef(Date.now());return Me.useEffect(()=>{if(!e||!(i!=null&&i.current))return;const a=ob(i.current,e),l=Date.now();n.current=l,a().then(u=>{n.current===l&&r(u)}).catch(u=>{console.error(u)})},[i,e]),Me.useEffect(()=>{const a=async(l,u)=>{let p=[];if(l.searchParams.get("output")==="vmap"){const w=await fetch(l.toString()),C=new DOMParser,v=await w.text(),D=C.parseFromString(v,"text/xml");p=new ab(D).adBreaks.map(L=>L.adSource.adTagURI.uri)}else p=[l.toString()];const g=await Promise.all(p.map((w,C)=>lb.get(w).then(v=>{if(s.current===u){const D=v.ads.find(U=>U.creatives.length>0);if(!D)return;const L=ub(D),O=cb(L);return{creative:L,order:C,mediaFileUrl:O,ad:D,raw:v}}}))),b=l.searchParams.get("vpa")!=="click",S=l.searchParams.get("vpmute")==="1";Oc.set({ads:g.filter(w=>!!w),autoplay:b,muted:S})};if(t){const l=Date.now();s.current=l,a(t,l)}return()=>{s.current=0}},[t]),Oc};var Mi={},vi={};function hb(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 n=i[r];if(e.call(void 0,n,r,i))return n}}function El(i,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(i):i}function pb(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 Uh=El({HTML:"text/html",isHTML:function(i){return i===Uh.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Mh=El({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(i){return i===Mh.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});vi.assign=pb;vi.find=hb;vi.freeze=El;vi.MIME_TYPE=Uh;vi.NAMESPACE=Mh;var Bh=vi,ii=Bh.find,Bn=Bh.NAMESPACE;function gb(i){return i!==""}function mb(i){return i?i.split(/[\t\n\f\r ]+/).filter(gb):[]}function fb(i,e){return i.hasOwnProperty(e)||(i[e]=!0),i}function Uc(i){if(!i)return[];var e=mb(i);return Object.keys(e.reduce(fb,{}))}function yb(i){return function(e){return i&&i.indexOf(e)!==-1}}function zn(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function vt(i,e){var t=i.prototype;if(!(t instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,zn(t,r),i.prototype=t=r}t.constructor!=i&&(typeof i!="function"&&console.error("unknown Class:"+i),t.constructor=i)}var Tt={},Ft=Tt.ELEMENT_NODE=1,Pr=Tt.ATTRIBUTE_NODE=2,zs=Tt.TEXT_NODE=3,Fh=Tt.CDATA_SECTION_NODE=4,jh=Tt.ENTITY_REFERENCE_NODE=5,_b=Tt.ENTITY_NODE=6,qh=Tt.PROCESSING_INSTRUCTION_NODE=7,$h=Tt.COMMENT_NODE=8,Vh=Tt.DOCUMENT_NODE=9,Hh=Tt.DOCUMENT_TYPE_NODE=10,fi=Tt.DOCUMENT_FRAGMENT_NODE=11,bb=Tt.NOTATION_NODE=12,rt={},Ye={};rt.INDEX_SIZE_ERR=(Ye[1]="Index size error",1);rt.DOMSTRING_SIZE_ERR=(Ye[2]="DOMString size error",2);var ft=rt.HIERARCHY_REQUEST_ERR=(Ye[3]="Hierarchy request error",3);rt.WRONG_DOCUMENT_ERR=(Ye[4]="Wrong document",4);rt.INVALID_CHARACTER_ERR=(Ye[5]="Invalid character",5);rt.NO_DATA_ALLOWED_ERR=(Ye[6]="No data allowed",6);rt.NO_MODIFICATION_ALLOWED_ERR=(Ye[7]="No modification allowed",7);var zh=rt.NOT_FOUND_ERR=(Ye[8]="Not found",8);rt.NOT_SUPPORTED_ERR=(Ye[9]="Not supported",9);var Mc=rt.INUSE_ATTRIBUTE_ERR=(Ye[10]="Attribute in use",10);rt.INVALID_STATE_ERR=(Ye[11]="Invalid state",11);rt.SYNTAX_ERR=(Ye[12]="Syntax error",12);rt.INVALID_MODIFICATION_ERR=(Ye[13]="Invalid modification",13);rt.NAMESPACE_ERR=(Ye[14]="Invalid namespace",14);rt.INVALID_ACCESS_ERR=(Ye[15]="Invalid access",15);function $e(i,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,Ye[i]),this.message=Ye[i],Error.captureStackTrace&&Error.captureStackTrace(this,$e);return t.code=i,e&&(this.message=this.message+": "+e),t}$e.prototype=Error.prototype;zn(rt,$e);function gi(){}gi.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++)vr(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 Rr(i,e){this._node=i,this._refresh=e,wl(this)}function wl(i){var e=i._node._inc||i._node.ownerDocument._inc;if(i._inc!==e){var t=i._refresh(i._node);if(rp(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];zn(t,i),i._inc=e}}Rr.prototype.item=function(i){return wl(this),this[i]||null};vt(Rr,gi);function Ws(){}function Wh(i,e){for(var t=i.length;t--;)if(i[t]===e)return t}function Bc(i,e,t,r){if(r?e[Wh(e,r)]=t:e[e.length++]=t,i){t.ownerElement=i;var n=i.ownerDocument;n&&(r&&Kh(n,i,r),vb(n,i,t))}}function Fc(i,e,t){var r=Wh(e,t);if(r>=0){for(var n=e.length-1;r<n;)e[r]=e[++r];if(e.length=n,i){var s=i.ownerDocument;s&&(Kh(s,i,t),t.ownerElement=null)}}else throw new $e(zh,new Error(i.tagName+"@"+t))}Ws.prototype={length:0,item:gi.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 $e(Mc);var t=this.getNamedItem(i.nodeName);return Bc(this._ownerElement,this,i,t),t},setNamedItemNS:function(i){var e=i.ownerElement,t;if(e&&e!=this._ownerElement)throw new $e(Mc);return t=this.getNamedItemNS(i.namespaceURI,i.localName),Bc(this._ownerElement,this,i,t),t},removeNamedItem:function(i){var e=this.getNamedItem(i);return Fc(this._ownerElement,this,e),e},removeNamedItemNS:function(i,e){var t=this.getNamedItemNS(i,e);return Fc(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 Gh(){}Gh.prototype={hasFeature:function(i,e){return!0},createDocument:function(i,e,t){var r=new Wn;if(r.implementation=this,r.childNodes=new gi,r.doctype=t||null,t&&r.appendChild(t),e){var n=r.createElementNS(i,e);r.appendChild(n)}return r},createDocumentType:function(i,e,t){var r=new Ta;return r.name=i,r.nodeName=i,r.publicId=e||"",r.systemId=t||"",r}};function _e(){}_e.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 Gs(this,i,e)},replaceChild:function(i,e){Gs(this,i,e,Qh),e&&this.removeChild(e)},removeChild:function(i){return Yh(this,i)},appendChild:function(i){return this.insertBefore(i,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(i){return Ho(this.ownerDocument||this,this,i)},normalize:function(){for(var i=this.firstChild;i;){var e=i.nextSibling;e&&e.nodeType==zs&&i.nodeType==zs?(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==Pr?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==Pr?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(i){var e=this.lookupPrefix(i);return e==null}};function Xh(i){return i=="<"&&"<"||i==">"&&">"||i=="&"&&"&"||i=='"'&&"""||"&#"+i.charCodeAt()+";"}zn(Tt,_e);zn(Tt,_e.prototype);function Fn(i,e){if(e(i))return!0;if(i=i.firstChild)do if(Fn(i,e))return!0;while(i=i.nextSibling)}function Wn(){this.ownerDocument=this}function vb(i,e,t){i&&i._inc++;var r=t.namespaceURI;r===Bn.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function Kh(i,e,t,r){i&&i._inc++;var n=t.namespaceURI;n===Bn.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function kl(i,e,t){if(i&&i._inc){i._inc++;var r=e.childNodes;if(t)r[r.length++]=t;else{for(var n=e.firstChild,s=0;n;)r[s++]=n,n=n.nextSibling;r.length=s,delete r[r.length]}}}function Yh(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,kl(i.ownerDocument,i),e}function Tb(i){return i&&(i.nodeType===_e.DOCUMENT_NODE||i.nodeType===_e.DOCUMENT_FRAGMENT_NODE||i.nodeType===_e.ELEMENT_NODE)}function Sb(i){return i&&(ri(i)||Cl(i)||yi(i)||i.nodeType===_e.DOCUMENT_FRAGMENT_NODE||i.nodeType===_e.COMMENT_NODE||i.nodeType===_e.PROCESSING_INSTRUCTION_NODE)}function yi(i){return i&&i.nodeType===_e.DOCUMENT_TYPE_NODE}function ri(i){return i&&i.nodeType===_e.ELEMENT_NODE}function Cl(i){return i&&i.nodeType===_e.TEXT_NODE}function jc(i,e){var t=i.childNodes||[];if(ii(t,ri)||yi(e))return!1;var r=ii(t,yi);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function qc(i,e){var t=i.childNodes||[];function r(s){return ri(s)&&s!==e}if(ii(t,r))return!1;var n=ii(t,yi);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function Eb(i,e,t){if(!Tb(i))throw new $e(ft,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new $e(zh,"child not in parent");if(!Sb(e)||yi(e)&&i.nodeType!==_e.DOCUMENT_NODE)throw new $e(ft,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function wb(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===_e.DOCUMENT_FRAGMENT_NODE){var s=n.filter(ri);if(s.length>1||ii(n,Cl))throw new $e(ft,"More than one element or text in fragment");if(s.length===1&&!jc(i,t))throw new $e(ft,"Element in fragment can not be inserted before doctype")}if(ri(e)&&!jc(i,t))throw new $e(ft,"Only one element can be added and only after doctype");if(yi(e)){if(ii(r,yi))throw new $e(ft,"Only one doctype is allowed");var a=ii(r,ri);if(t&&r.indexOf(a)<r.indexOf(t))throw new $e(ft,"Doctype can only be inserted before an element");if(!t&&a)throw new $e(ft,"Doctype can not be appended since element is present")}}function Qh(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===_e.DOCUMENT_FRAGMENT_NODE){var s=n.filter(ri);if(s.length>1||ii(n,Cl))throw new $e(ft,"More than one element or text in fragment");if(s.length===1&&!qc(i,t))throw new $e(ft,"Element in fragment can not be inserted before doctype")}if(ri(e)&&!qc(i,t))throw new $e(ft,"Only one element can be added and only after doctype");if(yi(e)){if(ii(r,function(l){return yi(l)&&l!==t}))throw new $e(ft,"Only one doctype is allowed");var a=ii(r,ri);if(t&&r.indexOf(a)<r.indexOf(t))throw new $e(ft,"Doctype can only be inserted before an element")}}function Gs(i,e,t,r){Eb(i,e,t),i.nodeType===_e.DOCUMENT_NODE&&(r||wb)(i,e,t);var n=e.parentNode;if(n&&n.removeChild(e),e.nodeType===fi){var s=e.firstChild;if(s==null)return e;var a=e.lastChild}else s=a=e;var l=t?t.previousSibling:i.lastChild;s.previousSibling=l,a.nextSibling=t,l?l.nextSibling=s:i.firstChild=s,t==null?i.lastChild=a:t.previousSibling=a;do s.parentNode=i;while(s!==a&&(s=s.nextSibling));return kl(i.ownerDocument||i,i),e.nodeType==fi&&(e.firstChild=e.lastChild=null),e}function kb(i,e){return 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,kl(i.ownerDocument,i,e),e}Wn.prototype={nodeName:"#document",nodeType:Vh,doctype:null,documentElement:null,_inc:1,insertBefore:function(i,e){if(i.nodeType==fi){for(var t=i.firstChild;t;){var r=t.nextSibling;this.insertBefore(t,e),t=r}return i}return Gs(this,i,e),i.ownerDocument=this,this.documentElement===null&&i.nodeType===Ft&&(this.documentElement=i),i},removeChild:function(i){return this.documentElement==i&&(this.documentElement=null),Yh(this,i)},replaceChild:function(i,e){Gs(this,i,e,Qh),i.ownerDocument=this,e&&this.removeChild(e),ri(i)&&(this.documentElement=i)},importNode:function(i,e){return ip(this,i,e)},getElementById:function(i){var e=null;return Fn(this.documentElement,function(t){if(t.nodeType==Ft&&t.getAttribute("id")==i)return e=t,!0}),e},getElementsByClassName:function(i){var e=Uc(i);return new Rr(this,function(t){var r=[];return e.length>0&&Fn(t.documentElement,function(n){if(n!==t&&n.nodeType===Ft){var s=n.getAttribute("class");if(s){var a=i===s;if(!a){var l=Uc(s);a=e.every(yb(l))}a&&r.push(n)}}}),r})},createElement:function(i){var e=new rr;e.ownerDocument=this,e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new gi;var t=e.attributes=new Ws;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new Sa;return i.ownerDocument=this,i.childNodes=new gi,i},createTextNode:function(i){var e=new Il;return e.ownerDocument=this,e.appendData(i),e},createComment:function(i){var e=new Al;return e.ownerDocument=this,e.appendData(i),e},createCDATASection:function(i){var e=new xl;return e.ownerDocument=this,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new Dl;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){var e=new Xs;return e.ownerDocument=this,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){var e=new Ll;return e.ownerDocument=this,e.nodeName=i,e},createElementNS:function(i,e){var t=new rr,r=e.split(":"),n=t.attributes=new Ws;return t.childNodes=new gi,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,n._ownerElement=t,t},createAttributeNS:function(i,e){var t=new Xs,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}};vt(Wn,_e);function rr(){this._nsMap={}}rr.prototype={nodeType:Ft,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===fi?this.insertBefore(i,null):kb(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 Rr(this,function(e){var t=[];return Fn(e,function(r){r!==e&&r.nodeType==Ft&&(i==="*"||r.tagName==i)&&t.push(r)}),t})},getElementsByTagNameNS:function(i,e){return new Rr(this,function(t){var r=[];return Fn(t,function(n){n!==t&&n.nodeType===Ft&&(i==="*"||n.namespaceURI===i)&&(e==="*"||n.localName==e)&&r.push(n)}),r})}};Wn.prototype.getElementsByTagName=rr.prototype.getElementsByTagName;Wn.prototype.getElementsByTagNameNS=rr.prototype.getElementsByTagNameNS;vt(rr,_e);function Xs(){}Xs.prototype.nodeType=Pr;vt(Xs,_e);function Gn(){}Gn.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(Ye[ft])},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var r=this.data.substring(0,i),n=this.data.substring(i+e);t=r+t+n,this.nodeValue=this.data=t,this.length=t.length}};vt(Gn,_e);function Il(){}Il.prototype={nodeName:"#text",nodeType:zs,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}};vt(Il,Gn);function Al(){}Al.prototype={nodeName:"#comment",nodeType:$h};vt(Al,Gn);function xl(){}xl.prototype={nodeName:"#cdata-section",nodeType:Fh};vt(xl,Gn);function Ta(){}Ta.prototype.nodeType=Hh;vt(Ta,_e);function Jh(){}Jh.prototype.nodeType=bb;vt(Jh,_e);function Zh(){}Zh.prototype.nodeType=_b;vt(Zh,_e);function Ll(){}Ll.prototype.nodeType=jh;vt(Ll,_e);function Sa(){}Sa.prototype.nodeName="#document-fragment";Sa.prototype.nodeType=fi;vt(Sa,_e);function Dl(){}Dl.prototype.nodeType=qh;vt(Dl,_e);function ep(){}ep.prototype.serializeToString=function(i,e,t){return tp.call(i,e,t)};_e.prototype.toString=tp;function tp(i,e){var t=[],r=this.nodeType==9&&this.documentElement||this,n=r.prefix,s=r.namespaceURI;if(s&&n==null){var n=r.lookupPrefix(s);if(n==null)var a=[{namespace:s,prefix:null}]}return vr(this,t,i,e,a),t.join("")}function $c(i,e,t){var r=i.prefix||"",n=i.namespaceURI;if(!n||r==="xml"&&n===Bn.XML||n===Bn.XMLNS)return!1;for(var s=t.length;s--;){var a=t[s];if(a.prefix===r)return a.namespace!==n}return!0}function bo(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,Xh),'"')}function vr(i,e,t,r,n){if(n||(n=[]),r)if(i=r(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case Ft:var s=i.attributes,a=s.length,l=i.firstChild,u=i.tagName;t=Bn.isHTML(i.namespaceURI)||t;var p=u;if(!t&&!i.prefix&&i.namespaceURI){for(var g,b=0;b<s.length;b++)if(s.item(b).name==="xmlns"){g=s.item(b).value;break}if(!g)for(var S=n.length-1;S>=0;S--){var w=n[S];if(w.prefix===""&&w.namespace===i.namespaceURI){g=w.namespace;break}}if(g!==i.namespaceURI)for(var S=n.length-1;S>=0;S--){var w=n[S];if(w.namespace===i.namespaceURI){w.prefix&&(p=w.prefix+":"+u);break}}}e.push("<",p);for(var C=0;C<a;C++){var v=s.item(C);v.prefix=="xmlns"?n.push({prefix:v.localName,namespace:v.value}):v.nodeName=="xmlns"&&n.push({prefix:"",namespace:v.value})}for(var C=0;C<a;C++){var v=s.item(C);if($c(v,t,n)){var D=v.prefix||"",L=v.namespaceURI;bo(e,D?"xmlns:"+D:"xmlns",L),n.push({prefix:D,namespace:L})}vr(v,e,t,r,n)}if(u===p&&$c(i,t,n)){var D=i.prefix||"",L=i.namespaceURI;bo(e,D?"xmlns:"+D:"xmlns",L),n.push({prefix:D,namespace:L})}if(l||t&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(e.push(">"),t&&/^script$/i.test(u))for(;l;)l.data?e.push(l.data):vr(l,e,t,r,n.slice()),l=l.nextSibling;else for(;l;)vr(l,e,t,r,n.slice()),l=l.nextSibling;e.push("</",p,">")}else e.push("/>");return;case Vh:case fi:for(var l=i.firstChild;l;)vr(l,e,t,r,n.slice()),l=l.nextSibling;return;case Pr:return bo(e,i.name,i.value);case zs:return e.push(i.data.replace(/[<&>]/g,Xh));case Fh:return e.push("<![CDATA[",i.data,"]]>");case $h:return e.push("<!--",i.data,"-->");case Hh:var O=i.publicId,U=i.systemId;if(e.push("<!DOCTYPE ",i.name),O)e.push(" PUBLIC ",O),U&&U!="."&&e.push(" ",U),e.push(">");else if(U&&U!=".")e.push(" SYSTEM ",U,">");else{var F=i.internalSubset;F&&e.push(" [",F,"]"),e.push(">")}return;case qh:return e.push("<?",i.target," ",i.data,"?>");case jh:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function ip(i,e,t){var r;switch(e.nodeType){case Ft:r=e.cloneNode(!1),r.ownerDocument=i;case fi:break;case Pr:t=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=i,r.parentNode=null,t)for(var n=e.firstChild;n;)r.appendChild(ip(i,n,t)),n=n.nextSibling;return r}function Ho(i,e,t){var r=new e.constructor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var s=e[n];typeof s!="object"&&s!=r[n]&&(r[n]=s)}switch(e.childNodes&&(r.childNodes=new gi),r.ownerDocument=i,r.nodeType){case Ft:var a=e.attributes,l=r.attributes=new Ws,u=a.length;l._ownerElement=r;for(var p=0;p<u;p++)r.setAttributeNode(Ho(i,a.item(p),!0));break;case Pr:t=!0}if(t)for(var g=e.firstChild;g;)r.appendChild(Ho(i,g,t)),g=g.nextSibling;return r}function rp(i,e,t){i[e]=t}try{if(Object.defineProperty){let i=function(e){switch(e.nodeType){case Ft:case fi: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(Rr.prototype,"length",{get:function(){return wl(this),this.$$length}}),Object.defineProperty(_e.prototype,"textContent",{get:function(){return i(this)},set:function(e){switch(this.nodeType){case Ft:case fi: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}}}),rp=function(e,t,r){e["$$"+t]=r}}}catch{}Mi.DocumentType=Ta;Mi.DOMException=$e;Mi.DOMImplementation=Gh;Mi.Element=rr;Mi.Node=_e;Mi.NodeList=gi;Mi.XMLSerializer=ep;var Ea={},np={};(function(i){var e=vi.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:`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react/jsx-runtime"),Me=require("react"),X=require("./provider.js"),ge=require("./useStreamLayerApp2.js"),g_=/^(?:[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 mh(i){return typeof i=="string"&&g_.test(i)}function gc(i){if(!mh(i))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(i.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(i.slice(9,13),16))>>>8,e&255,(e=parseInt(i.slice(14,18),16))>>>8,e&255,(e=parseInt(i.slice(19,23),16))>>>8,e&255,(e=parseInt(i.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}function m_(i){i=unescape(encodeURIComponent(i));const e=new Uint8Array(i.length);for(let t=0;t<i.length;++t)e[t]=i.charCodeAt(t);return e}const f_="6ba7b810-9dad-11d1-80b4-00c04fd430c8",y_="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function __(i,e,t,r,n,s){const a=typeof t=="string"?m_(t):t,l=typeof r=="string"?gc(r):r;if(typeof r=="string"&&(r=gc(r)),(r==null?void 0:r.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);if(u.set(l),u.set(a,l.length),u=e(u),u[6]=u[6]&15|i,u[8]=u[8]&63|128,n){s=s||0;for(let p=0;p<16;++p)n[s+p]=u[p];return n}return ge.unsafeStringify(u)}function b_(i,e,t,r){switch(i){case 0:return e&t^~e&r;case 1:return e^t^r;case 2:return e&t^e&r^t&r;case 3:return e^t^r}}function _o(i,e){return i<<e|i>>>32-e}function v_(i){const e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(i.length+1);r.set(i),r[i.length]=128,i=r;const n=i.length/4+2,s=Math.ceil(n/16),a=new Array(s);for(let l=0;l<s;++l){const u=new Uint32Array(16);for(let p=0;p<16;++p)u[p]=i[l*64+p*4]<<24|i[l*64+p*4+1]<<16|i[l*64+p*4+2]<<8|i[l*64+p*4+3];a[l]=u}a[s-1][14]=(i.length-1)*8/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=(i.length-1)*8&4294967295;for(let l=0;l<s;++l){const u=new Uint32Array(80);for(let C=0;C<16;++C)u[C]=a[l][C];for(let C=16;C<80;++C)u[C]=_o(u[C-3]^u[C-8]^u[C-14]^u[C-16],1);let p=t[0],g=t[1],b=t[2],S=t[3],w=t[4];for(let C=0;C<80;++C){const v=Math.floor(C/20),D=_o(p,5)+b_(v,g,b,S)+w+e[v]+u[C]>>>0;w=S,S=b,b=_o(g,30)>>>0,g=p,p=D}t[0]=t[0]+p>>>0,t[1]=t[1]+g>>>0,t[2]=t[2]+b>>>0,t[3]=t[3]+S>>>0,t[4]=t[4]+w>>>0}return Uint8Array.of(t[0]>>24,t[0]>>16,t[0]>>8,t[0],t[1]>>24,t[1]>>16,t[1]>>8,t[1],t[2]>>24,t[2]>>16,t[2]>>8,t[2],t[3]>>24,t[3]>>16,t[3]>>8,t[3],t[4]>>24,t[4]>>16,t[4]>>8,t[4])}function Hs(i,e,t,r){return __(80,v_,i,e,t,r)}Hs.DNS=f_;Hs.URL=y_;const T_=X.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),S_="a1rlj479",E_="s35f1di",w_="sj4471g",k_="b12050d8",C_="b1d5ybek",I_=i=>i==="left"||i==="right"?E_:k_,A_=i=>i==="left"||i==="right"?w_:C_,x_=i=>i==="left"?"avdxyl3":i==="right"?"a1bisd08":i==="top"?"a1u9y2aj":"a1qqaks",bl=({children:i,style:e,className:t,enabled:r=!0,hiding:n,direction:s="left",onAnimationEnd:a})=>W.jsx(T_,{style:e,className:X.cx_default(t,S_,x_(s),r&&!n&&I_(s),r&&n&&A_(s)),onAnimationEnd:a,children:i}),L_=X.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),D_=X.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),P_=()=>L_,R_=X.styled_default(P_())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),N_=({promotion:i,promotionId:e,hiding:t,direction:r="bottom"})=>{var n,s;if(!((n=i.additionalBanner)!=null&&n.imageUrl))return null;let a=(s=i.additionalBanner)==null?void 0:s.url;return a&&a.indexOf("http")!==0&&(a=`https://${a}`),W.jsx(bl,{direction:r,hiding:t,children:W.jsx(D_,{className:"BannerContainer",children:W.jsx(R_,{as:a?"a":"span",className:"BannerLink",href:a,style:{backgroundImage:`url(${i.additionalBanner.imageUrl})`,cursor:a?"pointer":"default"},"data-promo-id":e,"data-promo-type":i.type,"data-a":"banner",target:"_blank"})})})},O_=X.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),U_=X.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),M_=X.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),B_=X.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),vl=X.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),F_=()=>vl,j_=X.styled_default(F_())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),q_=X.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),$_=X.styled_default("button")({name:"Button",class:"bgl6boa",propsAsIs:!1}),V_=X.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),H_=X.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),z_=X.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),W_=X.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),G_={[ge.NotificationPromotionImagePosition.BOTTOM]:vl,[ge.NotificationPromotionImagePosition.MIDDLE]:j_},X_=({src:i,imagePosition:e})=>{const t=G_[e]||vl;return W.jsx(t,{children:W.jsx("img",{src:i,alt:""})})},K_=({notification:i,open:e})=>{if(!i||!i.promotion||i.enabled!==ge.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:t,body:r,image:n,promotion:s}=i,{sponsorLogo:a,sponsorLogoMode:l,imagePosition:u,ctaButton:p}=s;return W.jsxs(W_,{className:"SL_Lower_Third_Notification",onClick:e,children:[W.jsxs(O_,{children:[W.jsx(X_,{src:n,imagePosition:u}),W.jsxs(U_,{children:[t&&W.jsx(M_,{children:t}),r&&W.jsx(B_,{children:r})]})]}),W.jsxs(H_,{children:[l!==ge.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&W.jsxs(W.Fragment,{children:[W.jsx(V_,{children:W.jsx("img",{src:a,alt:t})}),W.jsx(z_,{})]}),W.jsxs($_,{name:"promo-button",style:{color:p==null?void 0:p.textColor,backgroundColor:p==null?void 0:p.color},children:[(p==null?void 0:p.ctaIcon)&&(p==null?void 0:p.ctaIconMode)===ge.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(q_,{src:p==null?void 0:p.ctaIcon,alt:"cta-icon"}),(p==null?void 0:p.label)||"Open"]})]})]})},Y_=X.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),Q_=X.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),J_=X.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),Z_=X.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),e0=X.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),va=X.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),t0=()=>va,mc=X.styled_default(t0())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),i0=()=>va,fh=X.styled_default(i0())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),r0=()=>fh,n0=X.styled_default(r0())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),s0=()=>va,a0=X.styled_default(s0())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),o0=()=>va,l0=X.styled_default(o0())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),u0=X.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),c0=X.styled_default("button")({name:"Button",class:"bis90pl",propsAsIs:!1}),d0=()=>X.k1,h0=X.styled_default(d0())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),p0=X.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),g0={[ge.NotificationPromotionImagePosition.UNSET]:mc,[ge.NotificationPromotionImagePosition.FIT]:mc,[ge.NotificationPromotionImagePosition.CENTERED]:fh,[ge.NotificationPromotionImagePosition.BOTTOM]:n0,[ge.NotificationPromotionImagePosition.SOLID]:a0,[ge.NotificationPromotionImagePosition.MIDDLE]:l0},m0=({src:i,imagePosition:e})=>{const t=g0[e];return W.jsx(t,{children:W.jsx("img",{src:i,alt:""})})},f0=({notification:i,open:e,promotionId:t,hiding:r,direction:n="left"})=>{if(!i||!i.promotion||i.enabled!==ge.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(i.promotion.mode===ge.NotificationPromotionMode.LOWER_THIRD)return W.jsx(K_,{notification:i,open:e});const{title:s,body:a,image:l,promotion:u}=i,{sponsorLogo:p,sponsorLogoMode:g,imagePosition:b,ctaButton:S}=u;return W.jsx(bl,{className:"SL_Rich_Notification",direction:n,hiding:r,children:W.jsxs(Q_,{onClick:e,children:[g!==ge.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&p&&W.jsx(p0,{children:W.jsx("img",{src:p,alt:s})}),W.jsxs(Y_,{children:[W.jsx(m0,{src:l,imagePosition:b}),W.jsxs(J_,{children:[s&&W.jsx(Z_,{children:s}),a&&W.jsx(e0,{children:a})]}),W.jsxs(c0,{name:"promo-button",style:{color:S==null?void 0:S.textColor,backgroundColor:S==null?void 0:S.color},children:[(S==null?void 0:S.ctaIcon)&&(S==null?void 0:S.ctaIconMode)===ge.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(u0,{src:S==null?void 0:S.ctaIcon,alt:"cta-icon"}),(S==null?void 0:S.label)||"Open"]}),W.jsx(h0,{name:"chevronRight"})]})]})})},y0=X.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),yh=X.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),_h=X.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),bh=X.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),vh="h10toh7",fc=X.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),_0=X.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),Th=X.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),b0=X.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),v0="s1nmch9k",yc=X.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),T0=X.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),S0=X.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),E0=X.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),Sh=X.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),w0=X.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),Eh=X.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),wh=X.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),k0=X.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),C0="h17rwbtk",I0=X.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),_c=X.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),A0=X.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),x0=({time:i,adCount:e,adPosition:t})=>{const r=Math.floor(i/60),n=i-r*60;return r===0&&n===0&&e===t?null:W.jsxs(I0,{children:[e>1&&W.jsxs(W.Fragment,{children:[W.jsxs(_c,{children:[t," of ",e]}),W.jsx(A0,{})]}),W.jsxs(_c,{children:[r,":",n<10?`0${n}`:n]})]})},L0=X.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),D0=({whyThisAd:i})=>{const[e,t]=Me.useState(!1);return!i.iconClickThroughURLTemplate||!i.staticResource?null:W.jsxs(L0,{style:{width:i.width,height:i.height,[i.xPosition]:3,[i.yPosition]:11},href:i.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!e&&W.jsx("img",{alt:"ad choice",src:i.staticResource,onLoad:()=>t(!1),onError:()=>t(!0)}),e&&W.jsx("span",{children:"ad choice"})]})},P0=X.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),kh=X.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),R0=()=>kh,N0=X.styled_default(R0())({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),O0=()=>kh,U0=X.styled_default(O0())({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),M0=X.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),B0=X.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),bc="m12n261r",vc="m16vcml8",Tc="m1078nk6",Sc=globalThis||void 0||self;function Tl(){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 F0=["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 Ec(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=[],n=Ih(i);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=Lh(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const s in e)e[s]=xh(e[s]);for(const s in n){const a=n[s];typeof a=="string"&&r.push(Ch(a,e))}return r}function Ch(i,e){const t=(i=wc(i,e)).match(/[^[\]]+(?=])/g);if(!t)return i;let r=t.filter(n=>F0.indexOf(n)>-1);return r.length===0?i:(r=r.reduce((n,s)=>(n[s]=-1,n),{}),wc(i,r))}function wc(i,e){let t=i;for(const r in e){const n=e[r];t=t.replace(new RegExp("(?:\\[|%%)(".concat(r,")(?:\\]|%%)"),"g"),n)}return t}function Ih(i){return Array.isArray(i)?i.map(e=>e&&e.hasOwnProperty("url")?e.url:e):i}function kc(i){return/^(https?:\/\/|\/\/)/.test(i)}function Cc(i,e){for(let t=0;t<e.length;t++)if(Ah(e[t],i))return!0;return!1}function Ah(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 xh(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function Lh(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;return i.toString().padStart(e,"0")}const Ee={track:function(i,e,t){Ec(i,e,t).forEach(r=>{typeof window<"u"&&window!==null&&(new Image().src=r)})},resolveURLTemplates:Ec,extractURLsFromTemplates:Ih,filterUrlTemplates:function(i){return i.reduce((e,t)=>{const r=t.url||t;return kc(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:Cc,isTemplateObjectEqual:Ah,encodeURIComponentRFC3986:xh,replaceUrlMacros:Ch,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((n,s)=>(Cc(s,n)||n.push(s),n),[])},isValidTimeValue:function(i){return Number.isFinite(i)&&i>=-2},addLeadingZeros:Lh,isValidUrl:kc,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 j0(i){if(i==null)return-1;if(Ee.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 n=parseInt(60*e[1]),s=parseInt(60*e[0]*60);return isNaN(s)||isNaN(n)||isNaN(r)||n>3600||r>60?-1:s+n+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:j0,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:n}=t;if(r&&n&&e.hasOwnProperty(r)){let s=n;typeof e[r]=="boolean"&&(s=Ic(s)),e[r]=s}})},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"),n=r.reduce((l,u)=>((u.variations||[]).forEach(p=>{(p.companionClickTrackingURLTemplates||[]).forEach(g=>{Ee.containsTemplateObject(g,l)||l.push(g)})}),l),[]);i.creatives=r.concat(i.creatives);const s=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 p=e.trackingEvents[l.type][u];Array.isArray(l.trackingEvents[u])||(l.trackingEvents[u]=[]),l.trackingEvents[u]=l.trackingEvents[u].concat(p)}l.type==="linear"&&(s&&(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"&&n.length&&(l.variations||[]).forEach(u=>{u.companionClickTrackingURLTemplates=Ee.joinArrayOfUniqueTemplateObjs(u.companionClickTrackingURLTemplates,n)})}),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 p;return((p=u.icons)===null||p===void 0?void 0:p.length)&&!u.mediaFiles.length});l.length&&(i.creatives=i.creatives.concat(l))}}};function q0(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:n,adId:s,sequence:a,apiFramework:l}=Tl(r);return{id:n,adId:s,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 n=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));n.htmlResources=j.childrenByName(r,"HTMLResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat(p):l},[]),n.iframeResources=j.childrenByName(r,"IFrameResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat(p):l},[]),n.staticResources=j.childrenByName(r,"StaticResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat({url:p,creativeType:u.getAttribute("creativeType")||null}):l},[]),n.altText=j.parseNodeText(j.childByName(r,"AltText"))||null;const s=j.childByName(r,"TrackingEvents");s&&j.childrenByName(s,"Tracking").forEach(l=>{const u=l.getAttribute("event"),p=j.parseNodeText(l);u&&p&&(Array.isArray(n.trackingEvents[u])||(n.trackingEvents[u]=[]),n.trackingEvents[u].push(p))}),n.companionClickTrackingURLTemplates=j.childrenByName(r,"CompanionClickTracking").map(l=>({id:l.getAttribute("id")||null,url:j.parseNodeText(l)})),n.companionClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"CompanionClickThrough"))||null;const a=j.childByName(r,"AdParameters");return a&&(n.adParameters={value:j.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),n}),t}function $0(i,e){let t;const r=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:p,adId:g,sequence:b,apiFramework:S}=Tl(u);return{id:p,adId:g,sequence:b,apiFramework:S,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 n=i.getAttribute("skipoffset");if(n==null)r.skipDelay=null;else if(n.charAt(n.length-1)==="%"&&r.duration!==-1){const u=parseInt(n,10);r.skipDelay=r.duration*(u/100)}else r.skipDelay=j.parseDuration(n);const s=j.childByName(i,"VideoClicks");if(s){const u=j.childByName(s,"ClickThrough");r.videoClickThroughURLTemplate=u?{id:u.getAttribute("id")||null,url:j.parseNodeText(u)}:null,j.childrenByName(s,"ClickTracking").forEach(p=>{r.videoClickTrackingURLTemplates.push({id:p.getAttribute("id")||null,url:j.parseNodeText(p)})}),j.childrenByName(s,"CustomClick").forEach(p=>{r.videoCustomClickURLTemplates.push({id:p.getAttribute("id")||null,url:j.parseNodeText(p)})})}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(p=>{let g=p.getAttribute("event");const b=j.parseNodeText(p);if(g&&b){if(g==="progress"){if(t=p.getAttribute("offset"),!t)return;g=t.charAt(t.length-1)==="%"?"progress-".concat(t):"progress-".concat(j.parseDuration(t))}Array.isArray(r.trackingEvents[g])||(r.trackingEvents[g]=[]),r.trackingEvents[g].push(b)}})}),j.childrenByName(i,"MediaFiles").forEach(u=>{j.childrenByName(u,"MediaFile").forEach(w=>{r.mediaFiles.push(function(C){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=C.getAttribute("id"),v.fileURL=j.parseNodeText(C),v.deliveryType=C.getAttribute("delivery"),v.codec=C.getAttribute("codec"),v.mimeType=C.getAttribute("type"),v.mediaType=C.getAttribute("mediaType")||"2D",v.apiFramework=C.getAttribute("apiFramework"),v.fileSize=parseInt(C.getAttribute("fileSize")||0),v.bitrate=parseInt(C.getAttribute("bitrate")||0),v.minBitrate=parseInt(C.getAttribute("minBitrate")||0),v.maxBitrate=parseInt(C.getAttribute("maxBitrate")||0),v.width=parseInt(C.getAttribute("width")||0),v.height=parseInt(C.getAttribute("height")||0);const D=C.getAttribute("scalable");D&&typeof D=="string"&&(v.scalable=j.parseBoolean(D));const L=C.getAttribute("maintainAspectRatio");return L&&typeof L=="string"&&(v.maintainAspectRatio=j.parseBoolean(L)),v}(w))});const p=j.childByName(u,"InteractiveCreativeFile");p&&(r.interactiveCreativeFile=function(w){const C=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(w));return C.fileURL=j.parseNodeText(w),C}(p));const g=j.childByName(u,"ClosedCaptionFiles");g&&j.childrenByName(g,"ClosedCaptionFile").forEach(w=>{const C=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(w));C.fileURL=j.parseNodeText(w),r.closedCaptionFiles.push(C)});const b=j.childByName(u,"Mezzanine"),S=function(w,C){const v={};let D=!1;return C.forEach(L=>{w&&w.getAttribute(L)?v[L]=w.getAttribute(L):D=!0}),D?null:v}(b,["delivery","type","width","height"]);if(S){const w={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};w.id=b.getAttribute("id"),w.fileURL=j.parseNodeText(b),w.delivery=S.delivery,w.codec=b.getAttribute("codec"),w.type=S.type,w.width=parseInt(S.width,10),w.height=parseInt(S.height,10),w.fileSize=parseInt(b.getAttribute("fileSize"),10),w.mediaType=b.getAttribute("mediaType")||"2D",r.mezzanine=w}});const l=j.childByName(i,"Icons");return l&&j.childrenByName(l,"Icon").forEach(u=>{r.icons.push(function(p){const g={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:[]};g.program=p.getAttribute("program"),g.height=parseInt(p.getAttribute("height")||0),g.width=parseInt(p.getAttribute("width")||0),g.xPosition=function(S){return["left","right"].indexOf(S)!==-1?S:parseInt(S||0)}(p.getAttribute("xPosition")),g.yPosition=function(S){return["top","bottom"].indexOf(S)!==-1?S:parseInt(S||0)}(p.getAttribute("yPosition")),g.apiFramework=p.getAttribute("apiFramework"),g.pxratio=p.getAttribute("pxratio")||"1",g.offset=j.parseDuration(p.getAttribute("offset")),g.duration=j.parseDuration(p.getAttribute("duration")),j.childrenByName(p,"HTMLResource").forEach(S=>{g.type=S.getAttribute("creativeType")||"text/html",g.htmlResource=j.parseNodeText(S)}),j.childrenByName(p,"IFrameResource").forEach(S=>{g.type=S.getAttribute("creativeType")||0,g.iframeResource=j.parseNodeText(S)}),j.childrenByName(p,"StaticResource").forEach(S=>{g.type=S.getAttribute("creativeType")||0,g.staticResource=j.parseNodeText(S)});const b=j.childByName(p,"IconClicks");if(b){g.iconClickThroughURLTemplate=j.parseNodeText(j.childByName(b,"IconClickThrough")),j.childrenByName(b,"IconClickTracking").forEach(w=>{g.iconClickTrackingURLTemplates.push({id:w.getAttribute("id")||null,url:j.parseNodeText(w)})});const S=j.childByName(b,"IconClickFallbackImages");S&&j.childrenByName(S,"IconClickFallbackImage").forEach(w=>{g.iconClickFallbackImages.push({url:j.parseNodeText(w)||null,width:w.getAttribute("width")||null,height:w.getAttribute("height")||null})})}return g.iconViewTrackingURLTemplate=j.parseNodeText(j.childByName(p,"IconViewTracking")),g}(u))}),r}function V0(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:n,adId:s,sequence:a,apiFramework:l}=Tl(r);return{id:n,adId:s,sequence:a,apiFramework:l,type:"nonlinear",variations:[],trackingEvents:{}}}(e);return j.childrenByName(i,"TrackingEvents").forEach(r=>{let n,s;j.childrenByName(r,"Tracking").forEach(a=>{n=a.getAttribute("event"),s=j.parseNodeText(a),n&&s&&(Array.isArray(t.trackingEvents[n])||(t.trackingEvents[n]=[]),t.trackingEvents[n].push(s))})}),j.childrenByName(i,"NonLinear").forEach(r=>{const n={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};n.id=r.getAttribute("id")||null,n.width=r.getAttribute("width"),n.height=r.getAttribute("height"),n.expandedWidth=r.getAttribute("expandedWidth"),n.expandedHeight=r.getAttribute("expandedHeight"),n.scalable=j.parseBoolean(r.getAttribute("scalable")),n.maintainAspectRatio=j.parseBoolean(r.getAttribute("maintainAspectRatio")),n.minSuggestedDuration=j.parseDuration(r.getAttribute("minSuggestedDuration")),n.apiFramework=r.getAttribute("apiFramework"),j.childrenByName(r,"HTMLResource").forEach(a=>{n.type=a.getAttribute("creativeType")||"text/html",n.htmlResource=j.parseNodeText(a)}),j.childrenByName(r,"IFrameResource").forEach(a=>{n.type=a.getAttribute("creativeType")||0,n.iframeResource=j.parseNodeText(a)}),j.childrenByName(r,"StaticResource").forEach(a=>{n.type=a.getAttribute("creativeType")||0,n.staticResource=j.parseNodeText(a)});const s=j.childByName(r,"AdParameters");s&&(n.adParameters={value:j.parseNodeText(s),xmlEncoded:s.getAttribute("xmlEncoded")||null}),n.nonlinearClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"NonLinearClickThrough")),j.childrenByName(r,"NonLinearClickTracking").forEach(a=>{n.nonlinearClickTrackingURLTemplates.push({id:a.getAttribute("id")||null,url:j.parseNodeText(a)})}),t.variations.push(n)}),t}function Ac(i){const e=[];return i.forEach(t=>{const r=Dh(t);r&&e.push(r)}),e}function Dh(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 s in t)if(t.hasOwnProperty(s)){const a=t[s];a.nodeName&&a.nodeValue&&(e.attributes[a.nodeName]=a.nodeValue)}}for(const s in r)if(r.hasOwnProperty(s)){const a=Dh(r[s]);a&&e.children.push(a)}if(e.children.length===0||e.children.length===1&&["#cdata-section","#text"].indexOf(e.children[0].name)>=0){const s=j.parseNodeText(i);s!==""&&(e.value=s),e.children=[]}return(n=e).value===null&&Object.keys(n.attributes).length===0&&n.children.length===0?null:e;var n}function H0(i){return i.getAttribute("AdID")||i.getAttribute("adID")||i.getAttribute("adId")||null}const js={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 xc(i,e){if(!js[i.nodeName]||!js[i.nodeName].attributes)return;const t=js[i.nodeName].attributes.filter(r=>!i.getAttribute(r));t.length>0&&Mn({name:i.nodeName,parentName:i.parentNode.nodeName,attributes:t},e)}function Lc(i,e,t){const r=js[i.nodeName],n=!t&&i.nodeName!=="Wrapper";if(!(!r||n)){if(r.subElements){const s=r.subElements.filter(a=>!j.childByName(i,a));s.length>0&&Mn({name:i.nodeName,parentName:i.parentNode.nodeName,subElements:s},e)}!t||!r.oneOfinLineResources||r.oneOfinLineResources.some(s=>j.childByName(i,s))||Mn({name:i.nodeName,parentName:i.parentNode.nodeName,oneOfResources:r.oneOfinLineResources},e)}}function Dc(i){return i.children&&i.children.length!==0}function Mn(i,e){let{name:t,parentName:r,attributes:n,subElements:s,oneOfResources:a}=i,l="Element '".concat(t,"'");l+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):s?" missing required sub element(s) '".concat(s.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",e("VAST-warning",{message:l,parentElement:r,specVersion:4.1})}const z0={verifyRequiredValues:function i(e,t,r){if(e&&e.nodeName)if(e.nodeName==="InLine"&&(r=!0),xc(e,t),Dc(e)){Lc(e,t,r);for(let n=0;n<e.children.length;n++)i(e.children[n],t,r)}else j.parseNodeText(e).length===0&&Mn({name:e.nodeName,parentName:e.parentNode.nodeName},t)},hasSubElements:Dc,emitMissingValueWarning:Mn,verifyRequiredAttributes:xc,verifyRequiredSubElements:Lc};function W0(i,e){let{allowMultipleAds:t,followAdditionalWrappers:r}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=Array.from(i.childNodes).filter(s=>{const a=s.nodeName.toLowerCase();return a==="inline"||r!==!1&&a==="wrapper"});for(const s of n){if(j.copyNodeAttribute("id",i,s),j.copyNodeAttribute("sequence",i,s),j.copyNodeAttribute("adType",i,s),s.nodeName==="Wrapper")return{ad:X0(s,e),type:"WRAPPER"};if(s.nodeName==="InLine")return{ad:G0(s,e,{allowMultipleAds:t}),type:"INLINE"};const a=s.nodeName.toLowerCase();e("VAST-warning",{message:"<".concat(s.nodeName,a==="inline"?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:s})}}function G0(i,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&i.getAttribute("sequence")?null:Ph(i,e)}function Ph(i,e){let t=[];e&&z0.verifyRequiredValues(i,e);const r=Array.from(i.childNodes),n=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:s.id||null,sequence:s.sequence||null,adType:s.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(s=>{switch(s.nodeName){case"Error":n.errorURLTemplates.push(j.parseNodeText(s));break;case"Impression":n.impressionURLTemplates.push({id:s.getAttribute("id")||null,url:j.parseNodeText(s)});break;case"Creatives":n.creatives=function(a){const l=[];return a.forEach(u=>{const p={id:u.getAttribute("id")||null,adId:H0(u),sequence:u.getAttribute("sequence")||null,apiFramework:u.getAttribute("apiFramework")||null},g=[];let b;j.childrenByName(u,"UniversalAdId").forEach(w=>{const C={idRegistry:w.getAttribute("idRegistry")||"unknown",value:j.parseNodeText(w)};g.push(C)});const S=j.childByName(u,"CreativeExtensions");S&&(b=Ac(j.childrenByName(S,"CreativeExtension")));for(const w in u.childNodes){const C=u.childNodes[w];let v;switch(C.nodeName){case"Linear":v=$0(C,p);break;case"NonLinearAds":v=V0(C,p);break;case"CompanionAds":v=q0(C,p)}v&&(g&&(v.universalAdIds=g),b&&(v.creativeExtensions=b),l.push(v))}}),l}(j.childrenByName(s,"Creative"));break;case"Extensions":{const a=j.childrenByName(s,"Extension");n.extensions=Ac(a),n.adVerifications.length||(t=function(l){let u=null,p=[];return l.some(g=>u=j.childByName(g,"AdVerifications")),u&&(p=Pc(j.childrenByName(u,"Verification"))),p}(a));break}case"AdVerifications":n.adVerifications=Pc(j.childrenByName(s,"Verification"));break;case"AdSystem":n.system={value:j.parseNodeText(s),version:s.getAttribute("version")||null};break;case"AdTitle":n.title=j.parseNodeText(s);break;case"AdServingId":n.adServingId=j.parseNodeText(s);break;case"Category":n.categories.push({authority:s.getAttribute("authority")||null,value:j.parseNodeText(s)});break;case"Expires":n.expires=parseInt(j.parseNodeText(s),10);break;case"ViewableImpression":n.viewableImpression.push(function(a){const l=(u,p)=>{const g=j.parseNodeText(p);return g&&u.push(g),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,[])}}(s));break;case"Description":n.description=j.parseNodeText(s);break;case"Advertiser":n.advertiser={id:s.getAttribute("id")||null,value:j.parseNodeText(s)};break;case"Pricing":n.pricing={value:j.parseNodeText(s),model:s.getAttribute("model")||null,currency:s.getAttribute("currency")||null};break;case"Survey":n.survey={value:j.parseNodeText(s),type:s.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:s.getAttribute("authority")||null,value:j.parseNodeText(s)})}}),t.length&&(n.adVerifications=n.adVerifications.concat(t)),n}function X0(i,e){const t=Ph(i,e),r=i.getAttribute("followAdditionalWrappers"),n=i.getAttribute("allowMultipleAds"),s=i.getAttribute("fallbackOnNoAd");t.followAdditionalWrappers=!r||j.parseBoolean(r),t.allowMultipleAds=!!n&&j.parseBoolean(n),t.fallbackOnNoAd=s?j.parseBoolean(s):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 p=l.trackingEvents[u];Array.isArray(t.trackingEvents[l.type][u])||(t.trackingEvents[l.type][u]=[]),p.forEach(g=>{t.trackingEvents[l.type][u].push(g)})}}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 Pc(i){const e=[];return i.forEach(t=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},n=Array.from(t.childNodes);j.assignAttributes(t.attributes,r),n.forEach(a=>{let{nodeName:l,textContent:u,attributes:p}=a;switch(l){case"JavaScriptResource":case"ExecutableResource":r.resource=u.trim(),j.assignAttributes(p,r);break;case"VerificationParameters":r.parameters=u.trim()}});const s=j.childByName(t,"TrackingEvents");s&&j.childrenByName(s,"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}let Rh=class{constructor(){this._handlers=[]}on(e,t){if(typeof t!="function")throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(r,n,s){const a={fired:!1,wrapFn:void 0};function l(){a.fired||(r.off(n,a.wrapFn),a.fired=!0,s.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),n=1;n<t;n++)r[n-1]=arguments[n];let s=!1;return this._handlers.forEach(a=>{a.event==="*"&&(s=!0,a.handler(e,...r)),a.event===e&&(s=!0,a.handler(...r))}),s}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)}},Rc=0,$o=0;const Nh=(i,e)=>{!i||!e||i<=0||e<=0||($o=($o*Rc+8*i/e)/++Rc)},K0={ERRORCODE:900,extensions:[]},Nc="VAST response version not supported";let Y0=class extends Rh{constructor(){let{fetcher:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null}trackVastError(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];this.emit("VAST-error",Object.assign({},K0,t,...n)),Ee.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return $o}initParsingStatus(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.rootURL="",this.resetParsingStatus(),Nh(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:n,errorURLTemplates:s,version:a}=r;return{ads:n||[],errorURLTemplates:s||[],version:a||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:n=null,wrapperDepth:s=0,allowMultipleAds:a,followAdditionalWrappers:l}=t;if(!e||!e.documentElement||e.documentElement.nodeName!=="VAST"){var u;this.emit("VAST-ad-parsed",{type:"ERROR",url:n,wrapperDepth:s});const S=(e==null||(u=e.documentElement)===null||u===void 0?void 0:u.nodeName)==="VideoAdServingTemplate";throw new Error(S?Nc:"Invalid VAST XMLDocument")}const p=[],g=e.documentElement.childNodes,b=e.documentElement.getAttribute("version");r&&b&&(this.vastVersion=b);for(const S in g){const w=g[S];if(w.nodeName==="Error"){const C=j.parseNodeText(w);r?this.rootErrorURLTemplates.push(C):this.errorURLTemplates.push(C)}else if(w.nodeName==="Ad"){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(a===!1&&p.length>1)break;const C=W0(w,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:l});C.ad?(p.push(C.ad),this.emit("VAST-ad-parsed",{type:C.type,url:n,wrapperDepth:s,adIndex:p.length-1,vastVersion:b})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return p}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:n=null,previousUrl:s=null,wrapperDepth:a=0,isRootVAST:l=!1,followAdditionalWrappers:u,allowMultipleAds:p}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&l&&(p=!0);try{g=this.parseVastXml(e,{isRootVAST:l,url:t,wrapperDepth:a,allowMultipleAds:p,followAdditionalWrappers:u})}catch(b){return Promise.reject(b)}if(g.length===1&&n!=null&&(g[0].sequence=n),r===!1){const b=j.getSortedAdPods(g),S=j.getStandAloneAds(g);b.length?g=b:S.length&&(g=[S.shift()]),this.remainingAds=S}return this.resolveAds(g,{wrapperDepth:a,previousUrl:s,url:t})}resolveAds(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:n}=arguments.length>1?arguments[1]:void 0;const s=[];return r=n,e.forEach(a=>{const l=this.resolveWrappers(a,t,r);s.push(l)}),Promise.all(s).then(a=>Ee.flatten(a))}resolveWrappers(e,t,r){const n={...e};return new Promise(s=>{var a;if(t++,!n.nextWrapperURL)return delete n.nextWrapperURL,s(n);if(!this.fetcher)return n.VASTAdTagURI=n.nextWrapperURL,delete n.nextWrapperURL,s(n);if(t>=this.maxWrapperDepth)return n.errorCode=302,delete n.nextWrapperURL,s(n);n.nextWrapperURL=j.resolveVastAdTagURI(n.nextWrapperURL,r);const l=(a=this.parsingOptions.allowMultipleAds)!==null&&a!==void 0?a:n.allowMultipleAds,u=n.sequence;this.fetcher.fetchVAST({url:n.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(p=>this.parse(p,{url:n.nextWrapperURL,previousUrl:r,wrapperSequence:u,wrapperDepth:t,followAdditionalWrappers:n.followAdditionalWrappers,allowMultipleAds:l}).then(g=>{if(delete n.nextWrapperURL,g.length===0)return n.creatives=[],s(n);g.forEach(b=>{b&&j.mergeWrapperAdData(b,n)}),s(g)})).catch(p=>{n.errorCode=p.message===Nc?102:301,n.errorMessage=p.message,s(n)})})}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],n=!r.creatives.some(s=>{var a;return((a=s.mediaFiles)===null||a===void 0?void 0:a.length)>0});!r.errorCode&&!n||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),e.ads.splice(t,1))}}},di=null;const Q0={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 J0{constructor(){this.storage=this.initStorage()}initStorage(){if(di)return di;try{di=typeof window<"u"&&window!==null?window.localStorage||window.sessionStorage:null}catch{di=null}return di&&!this.isStorageDisabled(di)||(di=Q0,di.clear()),di}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 Vo=12e4,Z0={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||Vo," ms (408)"))},e.timeout||Vo),n=await fetch(i,{...e,signal:t.signal,credentials:e.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(r)}),s=function(a){return Ee.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,")")}(n);return s?{error:new Error(s),statusCode:n.status}:async function(a){const l=await a.text();let u;return u=Ee.isBrowserEnvironment()?new DOMParser:new(await Promise.resolve().then(()=>jb).then(p=>p.i)).DOMParser,{xml:u.parseFromString(l,"text/xml"),details:{byteLength:l.length,statusCode:a.status,rawXml:l}}}(n)}catch(t){return{error:t,statusCode:t.name==="AbortError"?408:null}}}};let eb=class{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||Z0,this.fetchingOptions={timeout:e.timeout||Vo,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:n,emitter:s,wrapperDepth:a=0,previousUrl:l=null,wrapperAd:u=null}=e;const p=Date.now();this.URLTemplateFilters.forEach(S=>{r=S(r)}),s("VAST-resolving",{url:r,previousUrl:l,wrapperDepth:a,maxWrapperDepth:n,timeout:this.fetchingOptions.timeout,wrapperAd:u});const g=await this.urlHandler.get(r,this.fetchingOptions),b=Math.round(Date.now()-p);if(s("VAST-resolved",{url:r,previousUrl:l,wrapperDepth:a,error:(g==null?void 0:g.error)||null,duration:b,statusCode:(g==null?void 0:g.statusCode)||null,...g==null?void 0:g.details}),Nh(g==null||(t=g.details)===null||t===void 0?void 0:t.byteLength,b),g.error)throw new Error(g.error);return g.xml}},tb=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 J0;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new eb,this.vastParser=new Y0({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((n,s)=>{if(this.cappingFreeLunch>=this.totalCalls)return s(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 s(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 p=this.vastParser.buildVASTResponse(u);n(p)}))).catch(l=>s(l))})}},ib=class extends Rh{constructor(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,s=arguments.length>4&&arguments[4]!==void 0&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=s,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const a in this.creative.trackingEvents){const l=this.creative.trackingEvents[a];this.trackingEvents[a]=l.slice(0)}(function(a){return a.type==="linear"})(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}this.variation.adType==="nonLinearAd"?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return e.adType==="companionAd"}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){Ee.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(!Ee.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(Ee.formatMacrosValues(t))});const n=this.skipDelay||-1;if(n===-1||this.skippable||(n>e?this.emit("skip-countdown",n-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const s=Math.round(e/this.assetDuration*100),a=[];if(e>0){a.push("start");for(let l=this.lastPercentage;l<s;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=s}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 n=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(n=!0),n}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(Ee.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(Ee.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(Ee.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(Ee.formatMacrosValues(t))})}setSkipDelay(e){Ee.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewable,e)}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.notViewable,e)}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewUndetermined,e)}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"&&typeof t=="boolean"?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(Ee.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(Ee.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(s=>s.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const n=r.trackingEvents;if(n&&n.verificationNotExecuted){const s=n.verificationNotExecuted;this.trackURLs(s,t),this.emit("verificationNotExecuted",{trackingURLTemplates:s})}}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(Ee.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(Ee.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,n={...t};if(r){this.progress&&(n.ADPLAYHEAD=this.progressFormatted());const s=Ee.resolveURLTemplates([r],n)[0];this.emit("clickthrough",s)}}trackProgressEvents(e,t,r){const n=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(s=>{let[a]=s;return a.startsWith("progress-")}).map(s=>{let[a,l]=s;return{name:a,time:parseFloat(a.split("-")[1]),urls:l}}).filter(s=>{let{time:a}=s;return a<=n&&a>this.progress}).forEach(s=>{let{name:a,urls:l}=s;!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 n=this.trackingEvents[e],s=this.emitAlwaysEvents.indexOf(e)>-1;n?(this.emit(e,{trackingURLTemplates:n}),this.trackURLs(n,t)):s&&this.emit(e,null),r&&(delete this.trackingEvents[e],s&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{validUrls:s,invalidUrls:a}=Ee.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(","))),Ee.track(s,l,n)}convertToTimecode(e){if(!Ee.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),n=Math.floor(t/6e4%60),s=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(Ee.addLeadingZeros(r,2),":").concat(Ee.addLeadingZeros(n,2),":").concat(Ee.addLeadingZeros(s,2),".").concat(Ee.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}},rb=class{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 Oh(i,e){const t=[];for(const r in i.childNodes){const n=i.childNodes[r];(n.nodeName===e||e===`vmap:${n.nodeName}`||n.nodeName===`vmap:${e}`)&&t.push(n)}return t}function nb(i){if(!i||!i.childNodes)return{};const e=i.childNodes,t=[];for(const n in e){const s=e[n];s.nodeName==="#cdata-section"&&t.push(s)}if(t&&t.length>0)try{return JSON.parse(t[0].data)}catch{}let r="";for(const n in e){const s=e[n];switch(s.nodeName){case"#text":r+=s.textContent.trim();break;case"#cdata-section":r+=s.data;break}}return r}function Sl(i){const e={attributes:{},children:{},value:{}};e.value=nb(i);const t=i.attributes;if(t)for(const n in t){const s=t[n];s.nodeName&&s.nodeValue!==void 0&&s.nodeValue!==null&&(e.attributes[s.nodeName]=s.nodeValue)}const r=i.childNodes;if(r)for(const n in r){const s=r[n];s.nodeName&&s.nodeName.substring(0,1)!=="#"&&(e.children[s.nodeName]=Sl(s))}return e}let sb=class{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 rb(r);break;case"TrackingEvents":for(const n in r.childNodes){const s=r.childNodes[n];s.localName==="Tracking"&&this.trackingEvents.push({event:s.getAttribute("event"),uri:(s.textContent||s.text||"").trim()})}break;case"Extensions":this.extensions=Oh(r,"Extension").map(n=>Sl(n));break}}}track(e,t){for(const r in this.trackingEvents){const n=this.trackingEvents[r];if(n.event===e){let{uri:s}=n;n.event==="error"&&(s=s.replace("[ERRORCODE]",t)),this.tracker(s)}}}tracker(e){if(typeof window<"u"&&window!==null){const t=new Image;t.src=e}}};class ab{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 sb(r));break;case"Extensions":this.extensions=Oh(r,"Extension").map(n=>Sl(n));break}}}}const ob=(i,e)=>{const t=goog.pal,r=new t.ConsentSettings;r.allowStorage=!1;const n=new t.NonceLoader(r);return async()=>{try{const s=new URL(e),a=new t.NonceRequest;let l=localStorage.getItem("sl-device-id")||ge.v4(),u=sessionStorage.getItem("sl-ad-session-id");u||(u=ge.v4(),sessionStorage.setItem("sl-ad-session-id",u)),mh(l)||(l=Hs(`https://${l}`,Hs.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"),a.adWillAutoPlay=s.searchParams.get("vpa")==="auto",a.adWillPlayMuted=s.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=s.searchParams.get("description_url"),a.iconsSupported=!0,a.sessionId=l,a.supportedApiFrameworks="2,7,9",a.videoHeight=i.clientHeight,a.videoWidth=i.clientWidth;const p=await n.loadNonceManager(a);return s.searchParams.get("is_lat")==="[placeholder]"&&s.searchParams.set("is_lat","1"),s.searchParams.get("rdid")==="[placeholder]"&&s.searchParams.set("rdid",l),s.searchParams.get("correlator")==="[placeholder]"&&s.searchParams.set("correlator",u),s.searchParams.set("wta","1"),s.searchParams.set("givn",p.getNonce()),s}catch(s){console.log("AdsManager could not be started",s);return}}},lb=new tb,ub=i=>i.creatives.find(e=>e.mediaFiles),cb=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)||""},Oc=X.a$1({ads:[],autoplay:!0,muted:!1}),db=(i,e)=>{const[t,r]=Me.useState(),n=Me.useRef(Date.now()),s=Me.useRef(Date.now());return Me.useEffect(()=>{if(!e||!(i!=null&&i.current))return;const a=ob(i.current,e),l=Date.now();n.current=l,a().then(u=>{n.current===l&&r(u)}).catch(u=>{console.error(u)})},[i,e]),Me.useEffect(()=>{const a=async(l,u)=>{let p=[];if(l.searchParams.get("output")==="vmap"){const w=await fetch(l.toString()),C=new DOMParser,v=await w.text(),D=C.parseFromString(v,"text/xml");p=new ab(D).adBreaks.map(L=>L.adSource.adTagURI.uri)}else p=[l.toString()];const g=await Promise.all(p.map((w,C)=>lb.get(w).then(v=>{if(s.current===u){const D=v.ads.find(U=>U.creatives.length>0);if(!D)return;const L=ub(D),O=cb(L);return{creative:L,order:C,mediaFileUrl:O,ad:D,raw:v}}}))),b=l.searchParams.get("vpa")!=="click",S=l.searchParams.get("vpmute")==="1";Oc.set({ads:g.filter(w=>!!w),autoplay:b,muted:S})};if(t){const l=Date.now();s.current=l,a(t,l)}return()=>{s.current=0}},[t]),Oc};var Mi={},vi={};function hb(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 n=i[r];if(e.call(void 0,n,r,i))return n}}function El(i,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(i):i}function pb(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 Uh=El({HTML:"text/html",isHTML:function(i){return i===Uh.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Mh=El({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(i){return i===Mh.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});vi.assign=pb;vi.find=hb;vi.freeze=El;vi.MIME_TYPE=Uh;vi.NAMESPACE=Mh;var Bh=vi,ii=Bh.find,Bn=Bh.NAMESPACE;function gb(i){return i!==""}function mb(i){return i?i.split(/[\t\n\f\r ]+/).filter(gb):[]}function fb(i,e){return i.hasOwnProperty(e)||(i[e]=!0),i}function Uc(i){if(!i)return[];var e=mb(i);return Object.keys(e.reduce(fb,{}))}function yb(i){return function(e){return i&&i.indexOf(e)!==-1}}function zn(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function vt(i,e){var t=i.prototype;if(!(t instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,zn(t,r),i.prototype=t=r}t.constructor!=i&&(typeof i!="function"&&console.error("unknown Class:"+i),t.constructor=i)}var Tt={},Ft=Tt.ELEMENT_NODE=1,Pr=Tt.ATTRIBUTE_NODE=2,zs=Tt.TEXT_NODE=3,Fh=Tt.CDATA_SECTION_NODE=4,jh=Tt.ENTITY_REFERENCE_NODE=5,_b=Tt.ENTITY_NODE=6,qh=Tt.PROCESSING_INSTRUCTION_NODE=7,$h=Tt.COMMENT_NODE=8,Vh=Tt.DOCUMENT_NODE=9,Hh=Tt.DOCUMENT_TYPE_NODE=10,fi=Tt.DOCUMENT_FRAGMENT_NODE=11,bb=Tt.NOTATION_NODE=12,rt={},Ye={};rt.INDEX_SIZE_ERR=(Ye[1]="Index size error",1);rt.DOMSTRING_SIZE_ERR=(Ye[2]="DOMString size error",2);var ft=rt.HIERARCHY_REQUEST_ERR=(Ye[3]="Hierarchy request error",3);rt.WRONG_DOCUMENT_ERR=(Ye[4]="Wrong document",4);rt.INVALID_CHARACTER_ERR=(Ye[5]="Invalid character",5);rt.NO_DATA_ALLOWED_ERR=(Ye[6]="No data allowed",6);rt.NO_MODIFICATION_ALLOWED_ERR=(Ye[7]="No modification allowed",7);var zh=rt.NOT_FOUND_ERR=(Ye[8]="Not found",8);rt.NOT_SUPPORTED_ERR=(Ye[9]="Not supported",9);var Mc=rt.INUSE_ATTRIBUTE_ERR=(Ye[10]="Attribute in use",10);rt.INVALID_STATE_ERR=(Ye[11]="Invalid state",11);rt.SYNTAX_ERR=(Ye[12]="Syntax error",12);rt.INVALID_MODIFICATION_ERR=(Ye[13]="Invalid modification",13);rt.NAMESPACE_ERR=(Ye[14]="Invalid namespace",14);rt.INVALID_ACCESS_ERR=(Ye[15]="Invalid access",15);function $e(i,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,Ye[i]),this.message=Ye[i],Error.captureStackTrace&&Error.captureStackTrace(this,$e);return t.code=i,e&&(this.message=this.message+": "+e),t}$e.prototype=Error.prototype;zn(rt,$e);function gi(){}gi.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++)vr(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 Rr(i,e){this._node=i,this._refresh=e,wl(this)}function wl(i){var e=i._node._inc||i._node.ownerDocument._inc;if(i._inc!==e){var t=i._refresh(i._node);if(rp(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];zn(t,i),i._inc=e}}Rr.prototype.item=function(i){return wl(this),this[i]||null};vt(Rr,gi);function Ws(){}function Wh(i,e){for(var t=i.length;t--;)if(i[t]===e)return t}function Bc(i,e,t,r){if(r?e[Wh(e,r)]=t:e[e.length++]=t,i){t.ownerElement=i;var n=i.ownerDocument;n&&(r&&Kh(n,i,r),vb(n,i,t))}}function Fc(i,e,t){var r=Wh(e,t);if(r>=0){for(var n=e.length-1;r<n;)e[r]=e[++r];if(e.length=n,i){var s=i.ownerDocument;s&&(Kh(s,i,t),t.ownerElement=null)}}else throw new $e(zh,new Error(i.tagName+"@"+t))}Ws.prototype={length:0,item:gi.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 $e(Mc);var t=this.getNamedItem(i.nodeName);return Bc(this._ownerElement,this,i,t),t},setNamedItemNS:function(i){var e=i.ownerElement,t;if(e&&e!=this._ownerElement)throw new $e(Mc);return t=this.getNamedItemNS(i.namespaceURI,i.localName),Bc(this._ownerElement,this,i,t),t},removeNamedItem:function(i){var e=this.getNamedItem(i);return Fc(this._ownerElement,this,e),e},removeNamedItemNS:function(i,e){var t=this.getNamedItemNS(i,e);return Fc(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 Gh(){}Gh.prototype={hasFeature:function(i,e){return!0},createDocument:function(i,e,t){var r=new Wn;if(r.implementation=this,r.childNodes=new gi,r.doctype=t||null,t&&r.appendChild(t),e){var n=r.createElementNS(i,e);r.appendChild(n)}return r},createDocumentType:function(i,e,t){var r=new Ta;return r.name=i,r.nodeName=i,r.publicId=e||"",r.systemId=t||"",r}};function _e(){}_e.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 Gs(this,i,e)},replaceChild:function(i,e){Gs(this,i,e,Qh),e&&this.removeChild(e)},removeChild:function(i){return Yh(this,i)},appendChild:function(i){return this.insertBefore(i,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(i){return Ho(this.ownerDocument||this,this,i)},normalize:function(){for(var i=this.firstChild;i;){var e=i.nextSibling;e&&e.nodeType==zs&&i.nodeType==zs?(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==Pr?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==Pr?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(i){var e=this.lookupPrefix(i);return e==null}};function Xh(i){return i=="<"&&"<"||i==">"&&">"||i=="&"&&"&"||i=='"'&&"""||"&#"+i.charCodeAt()+";"}zn(Tt,_e);zn(Tt,_e.prototype);function Fn(i,e){if(e(i))return!0;if(i=i.firstChild)do if(Fn(i,e))return!0;while(i=i.nextSibling)}function Wn(){this.ownerDocument=this}function vb(i,e,t){i&&i._inc++;var r=t.namespaceURI;r===Bn.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function Kh(i,e,t,r){i&&i._inc++;var n=t.namespaceURI;n===Bn.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function kl(i,e,t){if(i&&i._inc){i._inc++;var r=e.childNodes;if(t)r[r.length++]=t;else{for(var n=e.firstChild,s=0;n;)r[s++]=n,n=n.nextSibling;r.length=s,delete r[r.length]}}}function Yh(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,kl(i.ownerDocument,i),e}function Tb(i){return i&&(i.nodeType===_e.DOCUMENT_NODE||i.nodeType===_e.DOCUMENT_FRAGMENT_NODE||i.nodeType===_e.ELEMENT_NODE)}function Sb(i){return i&&(ri(i)||Cl(i)||yi(i)||i.nodeType===_e.DOCUMENT_FRAGMENT_NODE||i.nodeType===_e.COMMENT_NODE||i.nodeType===_e.PROCESSING_INSTRUCTION_NODE)}function yi(i){return i&&i.nodeType===_e.DOCUMENT_TYPE_NODE}function ri(i){return i&&i.nodeType===_e.ELEMENT_NODE}function Cl(i){return i&&i.nodeType===_e.TEXT_NODE}function jc(i,e){var t=i.childNodes||[];if(ii(t,ri)||yi(e))return!1;var r=ii(t,yi);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function qc(i,e){var t=i.childNodes||[];function r(s){return ri(s)&&s!==e}if(ii(t,r))return!1;var n=ii(t,yi);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function Eb(i,e,t){if(!Tb(i))throw new $e(ft,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new $e(zh,"child not in parent");if(!Sb(e)||yi(e)&&i.nodeType!==_e.DOCUMENT_NODE)throw new $e(ft,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function wb(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===_e.DOCUMENT_FRAGMENT_NODE){var s=n.filter(ri);if(s.length>1||ii(n,Cl))throw new $e(ft,"More than one element or text in fragment");if(s.length===1&&!jc(i,t))throw new $e(ft,"Element in fragment can not be inserted before doctype")}if(ri(e)&&!jc(i,t))throw new $e(ft,"Only one element can be added and only after doctype");if(yi(e)){if(ii(r,yi))throw new $e(ft,"Only one doctype is allowed");var a=ii(r,ri);if(t&&r.indexOf(a)<r.indexOf(t))throw new $e(ft,"Doctype can only be inserted before an element");if(!t&&a)throw new $e(ft,"Doctype can not be appended since element is present")}}function Qh(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===_e.DOCUMENT_FRAGMENT_NODE){var s=n.filter(ri);if(s.length>1||ii(n,Cl))throw new $e(ft,"More than one element or text in fragment");if(s.length===1&&!qc(i,t))throw new $e(ft,"Element in fragment can not be inserted before doctype")}if(ri(e)&&!qc(i,t))throw new $e(ft,"Only one element can be added and only after doctype");if(yi(e)){if(ii(r,function(l){return yi(l)&&l!==t}))throw new $e(ft,"Only one doctype is allowed");var a=ii(r,ri);if(t&&r.indexOf(a)<r.indexOf(t))throw new $e(ft,"Doctype can only be inserted before an element")}}function Gs(i,e,t,r){Eb(i,e,t),i.nodeType===_e.DOCUMENT_NODE&&(r||wb)(i,e,t);var n=e.parentNode;if(n&&n.removeChild(e),e.nodeType===fi){var s=e.firstChild;if(s==null)return e;var a=e.lastChild}else s=a=e;var l=t?t.previousSibling:i.lastChild;s.previousSibling=l,a.nextSibling=t,l?l.nextSibling=s:i.firstChild=s,t==null?i.lastChild=a:t.previousSibling=a;do s.parentNode=i;while(s!==a&&(s=s.nextSibling));return kl(i.ownerDocument||i,i),e.nodeType==fi&&(e.firstChild=e.lastChild=null),e}function kb(i,e){return 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,kl(i.ownerDocument,i,e),e}Wn.prototype={nodeName:"#document",nodeType:Vh,doctype:null,documentElement:null,_inc:1,insertBefore:function(i,e){if(i.nodeType==fi){for(var t=i.firstChild;t;){var r=t.nextSibling;this.insertBefore(t,e),t=r}return i}return Gs(this,i,e),i.ownerDocument=this,this.documentElement===null&&i.nodeType===Ft&&(this.documentElement=i),i},removeChild:function(i){return this.documentElement==i&&(this.documentElement=null),Yh(this,i)},replaceChild:function(i,e){Gs(this,i,e,Qh),i.ownerDocument=this,e&&this.removeChild(e),ri(i)&&(this.documentElement=i)},importNode:function(i,e){return ip(this,i,e)},getElementById:function(i){var e=null;return Fn(this.documentElement,function(t){if(t.nodeType==Ft&&t.getAttribute("id")==i)return e=t,!0}),e},getElementsByClassName:function(i){var e=Uc(i);return new Rr(this,function(t){var r=[];return e.length>0&&Fn(t.documentElement,function(n){if(n!==t&&n.nodeType===Ft){var s=n.getAttribute("class");if(s){var a=i===s;if(!a){var l=Uc(s);a=e.every(yb(l))}a&&r.push(n)}}}),r})},createElement:function(i){var e=new rr;e.ownerDocument=this,e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new gi;var t=e.attributes=new Ws;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new Sa;return i.ownerDocument=this,i.childNodes=new gi,i},createTextNode:function(i){var e=new Il;return e.ownerDocument=this,e.appendData(i),e},createComment:function(i){var e=new Al;return e.ownerDocument=this,e.appendData(i),e},createCDATASection:function(i){var e=new xl;return e.ownerDocument=this,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new Dl;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){var e=new Xs;return e.ownerDocument=this,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){var e=new Ll;return e.ownerDocument=this,e.nodeName=i,e},createElementNS:function(i,e){var t=new rr,r=e.split(":"),n=t.attributes=new Ws;return t.childNodes=new gi,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,n._ownerElement=t,t},createAttributeNS:function(i,e){var t=new Xs,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}};vt(Wn,_e);function rr(){this._nsMap={}}rr.prototype={nodeType:Ft,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===fi?this.insertBefore(i,null):kb(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 Rr(this,function(e){var t=[];return Fn(e,function(r){r!==e&&r.nodeType==Ft&&(i==="*"||r.tagName==i)&&t.push(r)}),t})},getElementsByTagNameNS:function(i,e){return new Rr(this,function(t){var r=[];return Fn(t,function(n){n!==t&&n.nodeType===Ft&&(i==="*"||n.namespaceURI===i)&&(e==="*"||n.localName==e)&&r.push(n)}),r})}};Wn.prototype.getElementsByTagName=rr.prototype.getElementsByTagName;Wn.prototype.getElementsByTagNameNS=rr.prototype.getElementsByTagNameNS;vt(rr,_e);function Xs(){}Xs.prototype.nodeType=Pr;vt(Xs,_e);function Gn(){}Gn.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(Ye[ft])},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var r=this.data.substring(0,i),n=this.data.substring(i+e);t=r+t+n,this.nodeValue=this.data=t,this.length=t.length}};vt(Gn,_e);function Il(){}Il.prototype={nodeName:"#text",nodeType:zs,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}};vt(Il,Gn);function Al(){}Al.prototype={nodeName:"#comment",nodeType:$h};vt(Al,Gn);function xl(){}xl.prototype={nodeName:"#cdata-section",nodeType:Fh};vt(xl,Gn);function Ta(){}Ta.prototype.nodeType=Hh;vt(Ta,_e);function Jh(){}Jh.prototype.nodeType=bb;vt(Jh,_e);function Zh(){}Zh.prototype.nodeType=_b;vt(Zh,_e);function Ll(){}Ll.prototype.nodeType=jh;vt(Ll,_e);function Sa(){}Sa.prototype.nodeName="#document-fragment";Sa.prototype.nodeType=fi;vt(Sa,_e);function Dl(){}Dl.prototype.nodeType=qh;vt(Dl,_e);function ep(){}ep.prototype.serializeToString=function(i,e,t){return tp.call(i,e,t)};_e.prototype.toString=tp;function tp(i,e){var t=[],r=this.nodeType==9&&this.documentElement||this,n=r.prefix,s=r.namespaceURI;if(s&&n==null){var n=r.lookupPrefix(s);if(n==null)var a=[{namespace:s,prefix:null}]}return vr(this,t,i,e,a),t.join("")}function $c(i,e,t){var r=i.prefix||"",n=i.namespaceURI;if(!n||r==="xml"&&n===Bn.XML||n===Bn.XMLNS)return!1;for(var s=t.length;s--;){var a=t[s];if(a.prefix===r)return a.namespace!==n}return!0}function bo(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,Xh),'"')}function vr(i,e,t,r,n){if(n||(n=[]),r)if(i=r(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case Ft:var s=i.attributes,a=s.length,l=i.firstChild,u=i.tagName;t=Bn.isHTML(i.namespaceURI)||t;var p=u;if(!t&&!i.prefix&&i.namespaceURI){for(var g,b=0;b<s.length;b++)if(s.item(b).name==="xmlns"){g=s.item(b).value;break}if(!g)for(var S=n.length-1;S>=0;S--){var w=n[S];if(w.prefix===""&&w.namespace===i.namespaceURI){g=w.namespace;break}}if(g!==i.namespaceURI)for(var S=n.length-1;S>=0;S--){var w=n[S];if(w.namespace===i.namespaceURI){w.prefix&&(p=w.prefix+":"+u);break}}}e.push("<",p);for(var C=0;C<a;C++){var v=s.item(C);v.prefix=="xmlns"?n.push({prefix:v.localName,namespace:v.value}):v.nodeName=="xmlns"&&n.push({prefix:"",namespace:v.value})}for(var C=0;C<a;C++){var v=s.item(C);if($c(v,t,n)){var D=v.prefix||"",L=v.namespaceURI;bo(e,D?"xmlns:"+D:"xmlns",L),n.push({prefix:D,namespace:L})}vr(v,e,t,r,n)}if(u===p&&$c(i,t,n)){var D=i.prefix||"",L=i.namespaceURI;bo(e,D?"xmlns:"+D:"xmlns",L),n.push({prefix:D,namespace:L})}if(l||t&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(e.push(">"),t&&/^script$/i.test(u))for(;l;)l.data?e.push(l.data):vr(l,e,t,r,n.slice()),l=l.nextSibling;else for(;l;)vr(l,e,t,r,n.slice()),l=l.nextSibling;e.push("</",p,">")}else e.push("/>");return;case Vh:case fi:for(var l=i.firstChild;l;)vr(l,e,t,r,n.slice()),l=l.nextSibling;return;case Pr:return bo(e,i.name,i.value);case zs:return e.push(i.data.replace(/[<&>]/g,Xh));case Fh:return e.push("<![CDATA[",i.data,"]]>");case $h:return e.push("<!--",i.data,"-->");case Hh:var O=i.publicId,U=i.systemId;if(e.push("<!DOCTYPE ",i.name),O)e.push(" PUBLIC ",O),U&&U!="."&&e.push(" ",U),e.push(">");else if(U&&U!=".")e.push(" SYSTEM ",U,">");else{var F=i.internalSubset;F&&e.push(" [",F,"]"),e.push(">")}return;case qh:return e.push("<?",i.target," ",i.data,"?>");case jh:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function ip(i,e,t){var r;switch(e.nodeType){case Ft:r=e.cloneNode(!1),r.ownerDocument=i;case fi:break;case Pr:t=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=i,r.parentNode=null,t)for(var n=e.firstChild;n;)r.appendChild(ip(i,n,t)),n=n.nextSibling;return r}function Ho(i,e,t){var r=new e.constructor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var s=e[n];typeof s!="object"&&s!=r[n]&&(r[n]=s)}switch(e.childNodes&&(r.childNodes=new gi),r.ownerDocument=i,r.nodeType){case Ft:var a=e.attributes,l=r.attributes=new Ws,u=a.length;l._ownerElement=r;for(var p=0;p<u;p++)r.setAttributeNode(Ho(i,a.item(p),!0));break;case Pr:t=!0}if(t)for(var g=e.firstChild;g;)r.appendChild(Ho(i,g,t)),g=g.nextSibling;return r}function rp(i,e,t){i[e]=t}try{if(Object.defineProperty){let i=function(e){switch(e.nodeType){case Ft:case fi: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(Rr.prototype,"length",{get:function(){return wl(this),this.$$length}}),Object.defineProperty(_e.prototype,"textContent",{get:function(){return i(this)},set:function(e){switch(this.nodeType){case Ft:case fi: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}}}),rp=function(e,t,r){e["$$"+t]=r}}}catch{}Mi.DocumentType=Ta;Mi.DOMException=$e;Mi.DOMImplementation=Gh;Mi.Element=rr;Mi.Node=_e;Mi.NodeList=gi;Mi.XMLSerializer=ep;var Ea={},np={};(function(i){var e=vi.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:`
|
|
2
2
|
`,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})(np);var Pl={},jn=vi.NAMESPACE,zo=/[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]/,Vc=new RegExp("[\\-\\.0-9"+zo.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Hc=new RegExp("^"+zo.source+Vc.source+"*(?::"+zo.source+Vc.source+"*)?$"),yn=0,Ai=1,hr=2,_n=3,pr=4,gr=5,bn=6,Ps=7;function Nr(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Nr)}Nr.prototype=new Error;Nr.prototype.name=Nr.name;function sp(){}sp.prototype={parse:function(i,e,t){var r=this.domBuilder;r.startDocument(),ap(e,e={}),Cb(i,e,t,r,this.errorHandler),r.endDocument()}};function Cb(i,e,t,r,n){function s(de){if(de>65535){de-=65536;var we=55296+(de>>10),ze=56320+(de&1023);return String.fromCharCode(we,ze)}else return String.fromCharCode(de)}function a(de){var we=de.slice(1,-1);return Object.hasOwnProperty.call(t,we)?t[we]:we.charAt(0)==="#"?s(parseInt(we.substr(1).replace("x","0x"))):(n.error("entity not found:"+de),de)}function l(de){if(de>v){var we=i.substring(v,de).replace(/&#?\w+;/g,a);S&&u(v),r.characters(we,0,de-v),v=de}}function u(de,we){for(;de>=g&&(we=b.exec(i));)p=we.index,g=p+we[0].length,S.lineNumber++;S.columnNumber=de-p+1}for(var p=0,g=0,b=/.*(?:\r\n?|\n)|.*$/g,S=r.locator,w=[{currentNSMap:e}],C={},v=0;;){try{var D=i.indexOf("<",v);if(D<0){if(!i.substr(v).match(/^\s*$/)){var L=r.doc,O=L.createTextNode(i.substr(v));L.appendChild(O),r.currentElement=O}return}switch(D>v&&l(D),i.charAt(D+1)){case"/":var le=i.indexOf(">",D+3),U=i.substring(D+2,le).replace(/[ \t\n\r]+$/g,""),F=w.pop();le<0?(U=i.substring(D+2).replace(/[\s<].*/,""),n.error("end tag name: "+U+" is not complete:"+F.tagName),le=D+1+U.length):U.match(/\s</)&&(U=U.replace(/[\s<].*/,""),n.error("end tag name: "+U+" maybe not complete"),le=D+1+U.length);var N=F.localNSMap,V=F.tagName==U,J=V||F.tagName&&F.tagName.toLowerCase()==U.toLowerCase();if(J){if(r.endElement(F.uri,F.localName,U),N)for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&r.endPrefixMapping(Y);V||n.fatalError("end tag name: "+U+" is not match the current start tagName:"+F.tagName)}else w.push(F);le++;break;case"?":S&&u(D),le=Db(i,D,r);break;case"!":S&&u(D),le=Lb(i,D,r,n);break;default:S&&u(D);var ie=new op,he=w[w.length-1].currentNSMap,le=Ib(i,D,ie,he,a,n),pe=ie.length;if(!ie.closed&&xb(i,le,ie.tagName,C)&&(ie.closed=!0,t.nbsp||n.warning("unclosed xml attribute")),S&&pe){for(var ee=zc(S,{}),ce=0;ce<pe;ce++){var ne=ie[ce];u(ne.offset),ne.locator=zc(S,{})}r.locator=ee,Wc(ie,r,he)&&w.push(ie),r.locator=S}else Wc(ie,r,he)&&w.push(ie);jn.isHTML(ie.uri)&&!ie.closed?le=Ab(i,le,ie.tagName,a,r):le++}}catch(de){if(de instanceof Nr)throw de;n.error("element parse error: "+de),le=-1}le>v?v=le:l(Math.max(D,v)+1)}}function zc(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function Ib(i,e,t,r,n,s){function a(S,w,C){t.attributeNames.hasOwnProperty(S)&&s.fatalError("Attribute "+S+" redefined"),t.addValue(S,w.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,n),C)}for(var l,u,p=++e,g=yn;;){var b=i.charAt(p);switch(b){case"=":if(g===Ai)l=i.slice(e,p),g=_n;else if(g===hr)g=_n;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(g===_n||g===Ai)if(g===Ai&&(s.warning('attribute value must after "="'),l=i.slice(e,p)),e=p+1,p=i.indexOf(b,e),p>0)u=i.slice(e,p),a(l,u,e-1),g=gr;else throw new Error("attribute value no end '"+b+"' match");else if(g==pr)u=i.slice(e,p),a(l,u,e),s.warning('attribute "'+l+'" missed start quot('+b+")!!"),e=p+1,g=gr;else throw new Error('attribute value must after "="');break;case"/":switch(g){case yn:t.setTagName(i.slice(e,p));case gr:case bn:case Ps:g=Ps,t.closed=!0;case pr:case Ai:break;case hr:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),g==yn&&t.setTagName(i.slice(e,p)),p;case">":switch(g){case yn:t.setTagName(i.slice(e,p));case gr:case bn:case Ps:break;case pr:case Ai:u=i.slice(e,p),u.slice(-1)==="/"&&(t.closed=!0,u=u.slice(0,-1));case hr:g===hr&&(u=l),g==pr?(s.warning('attribute "'+u+'" missed quot(")!'),a(l,u,e)):((!jn.isHTML(r[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case _n:throw new Error("attribute value missed!!")}return p;case"":b=" ";default:if(b<=" ")switch(g){case yn:t.setTagName(i.slice(e,p)),g=bn;break;case Ai:l=i.slice(e,p),g=hr;break;case pr:var u=i.slice(e,p);s.warning('attribute "'+u+'" missed quot(")!!'),a(l,u,e);case gr:g=bn;break}else switch(g){case hr:t.tagName,(!jn.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,e),e=p,g=Ai;break;case gr:s.warning('attribute space is required"'+l+'"!!');case bn:g=Ai,e=p;break;case _n:g=pr,e=p;break;case Ps:throw new Error("elements closed character '/' and '>' must be connected to")}}p++}}function Wc(i,e,t){for(var r=i.tagName,n=null,s=i.length;s--;){var a=i[s],l=a.qName,u=a.value,S=l.indexOf(":");if(S>0)var p=a.prefix=l.slice(0,S),g=l.slice(S+1),b=p==="xmlns"&&g;else g=l,p=null,b=l==="xmlns"&&"";a.localName=g,b!==!1&&(n==null&&(n={},ap(t,t={})),t[b]=n[b]=u,a.uri=jn.XMLNS,e.startPrefixMapping(b,u))}for(var s=i.length;s--;){a=i[s];var p=a.prefix;p&&(p==="xml"&&(a.uri=jn.XML),p!=="xmlns"&&(a.uri=t[p||""]))}var S=r.indexOf(":");S>0?(p=i.prefix=r.slice(0,S),g=i.localName=r.slice(S+1)):(p=null,g=i.localName=r);var w=i.uri=t[p||""];if(e.startElement(w,g,r,i),i.closed){if(e.endElement(w,g,r),n)for(p in n)Object.prototype.hasOwnProperty.call(n,p)&&e.endPrefixMapping(p)}else return i.currentNSMap=t,i.localNSMap=n,!0}function Ab(i,e,t,r,n){if(/^(?:script|textarea)$/i.test(t)){var s=i.indexOf("</"+t+">",e),a=i.substring(e+1,s);if(/[&<]/.test(a))return/^script$/i.test(t)?(n.characters(a,0,a.length),s):(a=a.replace(/&#?\w+;/g,r),n.characters(a,0,a.length),s)}return e+1}function xb(i,e,t,r){var n=r[t];return n==null&&(n=i.lastIndexOf("</"+t+">"),n<e&&(n=i.lastIndexOf("</"+t)),r[t]=n),n<e}function ap(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function Lb(i,e,t,r){var n=i.charAt(e+2);switch(n){case"-":if(i.charAt(e+3)==="-"){var s=i.indexOf("-->",e+4);return s>e?(t.comment(i,e+4,s-e-4),s+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(i.substr(e+3,6)=="CDATA["){var s=i.indexOf("]]>",e+9);return t.startCDATA(),t.characters(i,e+9,s-e-9),t.endCDATA(),s+3}var a=Pb(i,e),l=a.length;if(l>1&&/!doctype/i.test(a[0][0])){var u=a[1][0],p=!1,g=!1;l>3&&(/^public$/i.test(a[2][0])?(p=a[3][0],g=l>4&&a[4][0]):/^system$/i.test(a[2][0])&&(g=a[3][0]));var b=a[l-1];return t.startDTD(u,p,g),t.endDTD(),b.index+b[0].length}}return-1}function Db(i,e,t){var r=i.indexOf("?>",e);if(r){var n=i.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return n?(n[0].length,t.processingInstruction(n[1],n[2]),r+2):-1}return-1}function op(){this.attributeNames={}}op.prototype={setTagName:function(i){if(!Hc.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!Hc.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 Pb(i,e){var t,r=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(n.lastIndex=e,n.exec(i);t=n.exec(i);)if(r.push(t),t[1])return r}Pl.XMLReader=sp;Pl.ParseError=Nr;var Rb=vi,Nb=Mi,Gc=np,lp=Pl,Ob=Nb.DOMImplementation,Xc=Rb.NAMESPACE,Ub=lp.ParseError,Mb=lp.XMLReader;function up(i){return i.replace(/\r[\n\u0085]/g,`
|
|
3
3
|
`).replace(/[\r\u0085\u2028]/g,`
|
|
4
4
|
`)}function cp(i){this.options=i||{locator:{}}}cp.prototype.parseFromString=function(i,e){var t=this.options,r=new Mb,n=t.domBuilder||new Xn,s=t.errorHandler,a=t.locator,l=t.xmlns||{},u=/\/x?html?$/.test(e),p=u?Gc.HTML_ENTITIES:Gc.XML_ENTITIES;a&&n.setDocumentLocator(a),r.errorHandler=Bb(s,n,a),r.domBuilder=t.domBuilder||n,u&&(l[""]=Xc.HTML),l.xml=l.xml||Xc.XML;var g=t.normalizeLineEndings||up;return i&&typeof i=="string"?r.parse(g(i),l,p):r.errorHandler.error("invalid doc source"),n.doc};function Bb(i,e,t){if(!i){if(e instanceof Xn)return e;i=e}var r={},n=i instanceof Function;t=t||{};function s(a){var l=i[a];!l&&n&&(l=i.length==2?function(u){i(a,u)}:i),r[a]=l&&function(u){l("[xmldom "+a+"] "+u+Wo(t))}||function(){}}return s("warning"),s("error"),s("fatalError"),r}function Xn(){this.cdata=!1}function mr(i,e){e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber}Xn.prototype={startDocument:function(){this.doc=new Ob().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(i,e,t,r){var n=this.doc,s=n.createElementNS(i,t||e),a=r.length;Rs(this,s),this.currentElement=s,this.locator&&mr(this.locator,s);for(var l=0;l<a;l++){var i=r.getURI(l),u=r.getValue(l),t=r.getQName(l),p=n.createAttributeNS(i,t);this.locator&&mr(r.getLocator(l),p),p.value=p.nodeValue=u,s.setAttributeNode(p)}},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&&mr(this.locator,t),Rs(this,t)},ignorableWhitespace:function(i,e,t){},characters:function(i,e,t){if(i=Kc.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&&mr(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=Kc.apply(this,arguments);var r=this.doc.createComment(i);this.locator&&mr(this.locator,r),Rs(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 n=r.createDocumentType(i,e,t);this.locator&&mr(this.locator,n),Rs(this,n),this.doc.doctype=n}},warning:function(i){console.warn("[xmldom warning] "+i,Wo(this.locator))},error:function(i){console.error("[xmldom error] "+i,Wo(this.locator))},fatalError:function(i){throw new Ub(i,this.locator)}};function Wo(i){if(i)return`
|
|
@@ -220,4 +220,4 @@ ${br(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),
|
|
|
220
220
|
`.split("").map(i=>i.charCodeAt(0)));class Hw extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class zw extends fl{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return it();const e=this.subtitlesTrack_.cues,t=e[0].startTime,r=e[e.length-1].startTime;return it([[t,r]])}initSegmentForMap(e,t=!1){if(!e)return null;const r=ma(e);let n=this.initSegments_[r];if(t&&!n&&e.bytes){const s=oh.byteLength+e.bytes.byteLength,a=new Uint8Array(s);a.set(e.bytes),a.set(oh,e.bytes.byteLength),this.initSegments_[r]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return n||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){xn(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===ti.TIMEOUT&&this.handleTimeout_(),e.code===ti.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const n=this.pendingSegment_,s=r.mp4VttCues&&r.mp4VttCues.length;s&&(n.mp4VttCues=r.mp4VttCues),this.saveBandwidthRelatedStats_(n.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const a=n.segment;if(a.map&&(a.map.bytes=t.map.bytes),n.bytes=t.bytes,typeof x.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_(n)}catch(l){this.stopForError({message:l.message,metadata:{errorType:B.Error.StreamingVttParserError,error:l}});return}if(s||this.updateTimeMapping_(n,this.syncController_.timelines[n.timeline],this.playlist_),n.cues.length?n.timingInfo={start:n.cues[0].startTime,end:n.cues[n.cues.length-1].endTime}:n.timingInfo={start:n.startOfSegment,end:n.startOfSegment+n.duration},n.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}n.byteLength=n.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,n.cues.forEach(l=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new x.VTTCue(l.startTime,l.endTime,l.text):l)}),Iw(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const r=e&&e.type==="vtt",n=t&&t.type==="text";r&&n&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(r=>{const n=r.start+t,s=r.end+t,a=new x.VTTCue(n,s,r.cueText);r.settings&&r.settings.split(" ").forEach(l=>{const u=l.split(":"),p=u[0],g=u[1];a[p]=isNaN(g)?g:Number(g)}),e.cues.push(a)})}parseVTTCues_(e){let t,r=!1;if(typeof x.WebVTT!="function")throw new Hw;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof x.TextDecoder=="function"?t=new x.TextDecoder("utf8"):(t=x.WebVTT.StringDecoder(),r=!0);const n=new x.WebVTT.Parser(x,x.vttjs,t);if(n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=a=>{e.timestampmap=a},n.onparsingerror=a=>{B.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;r&&(a=ah(a)),n.parse(a)}let s=e.bytes;r&&(s=ah(s)),n.parse(s),n.flush()}updateTimeMapping_(e,t,r){const n=e.segment;if(!t)return;if(!e.cues.length){n.empty=!0;return}const{MPEGTS:s,LOCAL:a}=e.timestampmap,l=s/Yi.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(u=>{const p=u.endTime-u.startTime,g=this.handleRollover_(u.startTime+l,t.time);u.startTime=Math.max(g,0),u.endTime=Math.max(g+p,0)}),!r.syncInfo){const u=e.cues[0].startTime,p=e.cues[e.cues.length-1].startTime;r.syncInfo={mediaSequence:r.mediaSequence+e.mediaIndex,time:Math.min(u,p-n.duration)}}}handleRollover_(e,t){if(t===null)return e;let r=e*Yi.ONE_SECOND_IN_TS;const n=t*Yi.ONE_SECOND_IN_TS;let s;for(n<r?s=-8589934592:s=8589934592;Math.abs(r-n)>4294967296;)r+=s;return r/Yi.ONE_SECOND_IN_TS}}const Ww=function(i,e){const t=i.cues;for(let r=0;r<t.length;r++){const n=t[r];if(e>=n.adStartTime&&e<=n.adEndTime)return n}return null},Gw=function(i,e,t=0){if(!i.segments)return;let r=t,n;for(let s=0;s<i.segments.length;s++){const a=i.segments[s];if(n||(n=Ww(e,r+a.duration/2)),n){if("cueIn"in a){n.endTime=r,n.adEndTime=r,r+=a.duration,n=null;continue}if(r<n.endTime){r+=a.duration;continue}n.endTime+=a.duration}else if("cueOut"in a&&(n=new x.VTTCue(r,r+a.duration,a.cueOut),n.adStartTime=r,n.adEndTime=r+parseFloat(a.cueOut),e.addCue(n)),"cueOutCont"in a){const[l,u]=a.cueOutCont.split("/").map(parseFloat);n=new x.VTTCue(r,r+a.duration,""),n.adStartTime=r-l,n.adEndTime=n.adStartTime+u,e.addCue(n)}r+=a.duration}};class lh{constructor({start:e,end:t,segmentIndex:r,partIndex:n=null,appended:s=!1}){this.start_=e,this.end_=t,this.segmentIndex_=r,this.partIndex_=n,this.appended_=s}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 Xw{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 Gm{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:n}=e;if(this.isReliable_=this.isReliablePlaylist_(r,n),!!this.isReliable_)return this.updateStorage_(n,r,this.calculateBaseTime_(r,n,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:r}of this.storage_.values())if(r.length){for(const n of r)if(n.isInRange(e))return n}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,r){const n=new Map;let s=`
|
|
221
221
|
`,a=r,l=t;this.start_=a,e.forEach((u,p)=>{const g=this.storage_.get(l),b=a,S=b+u.duration,w=!!(g&&g.segmentSyncInfo&&g.segmentSyncInfo.isAppended),C=new lh({start:b,end:S,appended:w,segmentIndex:p});u.syncInfo=C;let v=a;const D=(u.parts||[]).map((L,O)=>{const U=v,F=v+L.duration,N=!!(g&&g.partsSyncInfo&&g.partsSyncInfo[O]&&g.partsSyncInfo[O].isAppended),V=new lh({start:U,end:F,appended:N,segmentIndex:p,partIndex:O});return v=F,s+=`Media Sequence: ${l}.${O} | Range: ${U} --> ${F} | Appended: ${N}
|
|
222
222
|
`,L.syncInfo=V,V});n.set(l,new Xw(C,D)),s+=`${Vm(u.resolvedUri)} | Media Sequence: ${l} | Range: ${b} --> ${S} | Appended: ${w}
|
|
223
|
-
`,l++,a=S}),this.end_=a,this.storage_=n,this.diagnostics_=s}calculateBaseTime_(e,t,r){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const n=Math.min(...this.storage_.keys());if(e<n){const s=n-e;let a=this.storage_.get(n).segmentSyncInfo.start;for(let l=0;l<s;l++){const u=t[l];a-=u.duration}return a}return r}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class uh extends Gm{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,r){if(!this.storage_.size){const n=this.parent_.getSyncInfoForMediaSequence(e);return n?n.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,r)}}const Kw=86400,qo=[{name:"VOD",run:(i,e,t,r,n)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(i,e,t,r,n,s)=>{const a=i.getMediaSequenceSync(s);if(!a||!a.isReliable)return null;const l=a.getSyncInfoForTime(n);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(i,e,t,r,n)=>{if(!Object.keys(i.timelineToDatetimeMappings).length)return null;let s=null,a=null;const l=ol(e);n=n||0;for(let u=0;u<l.length;u++){const p=e.endList||n===0?u:l.length-(u+1),g=l[p],b=g.segment,S=i.timelineToDatetimeMappings[b.timeline];if(!S||!b.dateTimeObject)continue;let w=b.dateTimeObject.getTime()/1e3+S;if(b.parts&&typeof g.partIndex=="number")for(let v=0;v<g.partIndex;v++)w+=b.parts[v].duration;const C=Math.abs(n-w);if(a!==null&&(C===0||a<C))break;a=C,s={time:w,segmentIndex:g.segmentIndex,partIndex:g.partIndex}}return s}},{name:"Segment",run:(i,e,t,r,n)=>{let s=null,a=null;n=n||0;const l=ol(e);for(let u=0;u<l.length;u++){const p=e.endList||n===0?u:l.length-(u+1),g=l[p],b=g.segment,S=g.part&&g.part.start||b&&b.start;if(b.timeline===r&&typeof S<"u"){const w=Math.abs(n-S);if(a!==null&&a<w)break;(!s||a===null||a>=w)&&(a=w,s={time:S,segmentIndex:g.segmentIndex,partIndex:g.partIndex})}}return s}},{name:"Discontinuity",run:(i,e,t,r,n)=>{let s=null;if(n=n||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let l=0;l<e.discontinuityStarts.length;l++){const u=e.discontinuityStarts[l],p=e.discontinuitySequence+l+1,g=i.discontinuities[p];if(g){const b=Math.abs(n-g.time);if(a!==null&&a<b)break;(!s||a===null||a>=b)&&(a=b,s={time:g.time,segmentIndex:u,partIndex:null})}}}return s}},{name:"Playlist",run:(i,e,t,r,n)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class Yw extends B.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Gm,r=new uh(t),n=new uh(t);this.mediaSequenceStorage_={main:t,audio:r,vtt:n},this.logger_=Nt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,r,n,s){if(t!==1/0)return qo.find(({name:l})=>l==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,r,n,s);if(!a.length)return null;for(const l of a){const{syncPoint:u,strategy:p}=l,{segmentIndex:g,time:b}=u;if(g<0)continue;const S=e.segments[g],w=b,C=w+S.duration;if(this.logger_(`Strategy: ${p}. Current time: ${n}. selected segment: ${g}. Time: [${w} -> ${C}]}`),n>=w&&n<C)return this.logger_("Found sync point with exact match: ",u),u}return this.selectSyncPoint_(a,{key:"time",value:n})}getExpiredTime(e,t){if(!e||!e.segments)return null;const r=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!r.length)return null;const n=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+On({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))}runStrategies_(e,t,r,n,s){const a=[];for(let l=0;l<qo.length;l++){const u=qo[l],p=u.run(this,e,t,r,n,s);p&&(p.strategy=u.name,a.push({strategy:u.name,syncPoint:p}))}return a}selectSyncPoint_(e,t){let r=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),s=e[0].strategy;for(let a=1;a<e.length;a++){const l=Math.abs(e[a].syncPoint[t.key]-t.value);l<n&&(n=l,r=e[a].syncPoint,s=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${s}]: [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>Kw){B.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let n=r-1;n>=0;n--){const s=e.segments[n];if(s&&typeof s.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+n,time:s.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),n=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start}));const s=n.dateTimeObject;n.discontinuity&&t&&s&&(this.timelineToDatetimeMappings[n.timeline]=-(s.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 n=e.segment,s=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 s&&(s.start=l,s.end=u),(!n.start||l<n.start)&&(n.start=l),n.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 n=0;n<t.discontinuityStarts.length;n++){const s=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,l=s-e.mediaIndex,u=Math.abs(l);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>u){let p;l<0?p=r.start-On({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:s}):p=r.end+On({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[a]={time:p,accuracy:u}}}}dispose(){this.trigger("dispose"),this.off()}}class Qw extends B.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 n={timelineChangeInfo:{from:t,to:r}};this.trigger({type:"timelinechange",metadata:n})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Jw=Dm(Pm(function(){var i=function(){function v(){this.listeners={}}var D=v.prototype;return D.on=function(L,O){this.listeners[L]||(this.listeners[L]=[]),this.listeners[L].push(O)},D.off=function(L,O){if(!this.listeners[L])return!1;var U=this.listeners[L].indexOf(O);return this.listeners[L]=this.listeners[L].slice(0),this.listeners[L].splice(U,1),U>-1},D.trigger=function(L){var O=this.listeners[L];if(O)if(arguments.length===2)for(var U=O.length,F=0;F<U;++F)O[F].call(this,arguments[1]);else for(var N=Array.prototype.slice.call(arguments,1),V=O.length,J=0;J<V;++J)O[J].apply(this,N)},D.dispose=function(){this.listeners={}},D.pipe=function(L){this.on("data",function(O){L.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=[[[],[],[],[],[]],[[],[],[],[],[]]],D=v[0],L=v[1],O=D[4],U=L[4];let F,N,V;const J=[],Y=[];let ie,he,le,pe,ee,ce;for(F=0;F<256;F++)Y[(J[F]=F<<1^(F>>7)*283)^F]=F;for(N=V=0;!O[N];N^=ie||1,V=Y[V]||1)for(pe=V^V<<1^V<<2^V<<3^V<<4,pe=pe>>8^pe&255^99,O[N]=pe,U[pe]=N,le=J[he=J[ie=J[N]]],ce=le*16843009^he*65537^ie*257^N*16843008,ee=J[pe]*257^pe*16843008,F=0;F<4;F++)D[F][N]=ee=ee<<24^ee>>>8,L[F][pe]=ce=ce<<24^ce>>>8;for(F=0;F<5;F++)D[F]=D[F].slice(0),L[F]=L[F].slice(0);return v};let r=null;class n{constructor(D){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 L,O,U;const F=this._tables[0][4],N=this._tables[1],V=D.length;let J=1;if(V!==4&&V!==6&&V!==8)throw new Error("Invalid aes key size");const Y=D.slice(0),ie=[];for(this._key=[Y,ie],L=V;L<4*V+28;L++)U=Y[L-1],(L%V===0||V===8&&L%V===4)&&(U=F[U>>>24]<<24^F[U>>16&255]<<16^F[U>>8&255]<<8^F[U&255],L%V===0&&(U=U<<8^U>>>24^J<<24,J=J<<1^(J>>7)*283)),Y[L]=Y[L-V]^U;for(O=0;L;O++,L--)U=Y[O&3?L:L-4],L<=4||O<4?ie[O]=U:ie[O]=N[0][F[U>>>24]]^N[1][F[U>>16&255]]^N[2][F[U>>8&255]]^N[3][F[U&255]]}decrypt(D,L,O,U,F,N){const V=this._key[1];let J=D^V[0],Y=U^V[1],ie=O^V[2],he=L^V[3],le,pe,ee;const ce=V.length/4-2;let ne,de=4;const we=this._tables[1],ze=we[0],dt=we[1],Ot=we[2],ht=we[3],Ut=we[4];for(ne=0;ne<ce;ne++)le=ze[J>>>24]^dt[Y>>16&255]^Ot[ie>>8&255]^ht[he&255]^V[de],pe=ze[Y>>>24]^dt[ie>>16&255]^Ot[he>>8&255]^ht[J&255]^V[de+1],ee=ze[ie>>>24]^dt[he>>16&255]^Ot[J>>8&255]^ht[Y&255]^V[de+2],he=ze[he>>>24]^dt[J>>16&255]^Ot[Y>>8&255]^ht[ie&255]^V[de+3],de+=4,J=le,Y=pe,ie=ee;for(ne=0;ne<4;ne++)F[(3&-ne)+N]=Ut[J>>>24]<<24^Ut[Y>>16&255]<<16^Ut[ie>>8&255]<<8^Ut[he&255]^V[de++],le=J,J=Y,Y=ie,ie=he,he=le}}class s 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(D){this.jobs.push(D),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,D,L){const O=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),U=new n(Array.prototype.slice.call(D)),F=new Uint8Array(v.byteLength),N=new Int32Array(F.buffer);let V,J,Y,ie,he,le,pe,ee,ce;for(V=L[0],J=L[1],Y=L[2],ie=L[3],ce=0;ce<O.length;ce+=4)he=a(O[ce]),le=a(O[ce+1]),pe=a(O[ce+2]),ee=a(O[ce+3]),U.decrypt(he,le,pe,ee,N,ce),N[ce]=a(N[ce]^V),N[ce+1]=a(N[ce+1]^J),N[ce+2]=a(N[ce+2]^Y),N[ce+3]=a(N[ce+3]^ie),V=he,J=le,Y=pe,ie=ee;return F};class u{constructor(D,L,O,U){const F=u.STEP,N=new Int32Array(D.buffer),V=new Uint8Array(D.byteLength);let J=0;for(this.asyncStream_=new s,this.asyncStream_.push(this.decryptChunk_(N.subarray(J,J+F),L,O,V)),J=F;J<N.length;J+=F)O=new Uint32Array([a(N[J-4]),a(N[J-3]),a(N[J-2]),a(N[J-1])]),this.asyncStream_.push(this.decryptChunk_(N.subarray(J,J+F),L,O,V));this.asyncStream_.push(function(){U(null,e(V))})}static get STEP(){return 32e3}decryptChunk_(D,L,O,U){return function(){const F=l(D,L,O);U.set(F,D.byteOffset)}}}var p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ys<"u"?Ys:typeof self<"u"?self:{},g;typeof window<"u"?g=window:typeof p<"u"?g=p:typeof self<"u"?g=self:g={};var b=g,S=function(v){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(v):v&&v.buffer instanceof ArrayBuffer},w=b.BigInt||Number;w("0x1"),w("0x100"),w("0x10000"),w("0x1000000"),w("0x100000000"),w("0x10000000000"),w("0x1000000000000"),w("0x100000000000000"),w("0x10000000000000000"),function(){var v=new Uint16Array([65484]),D=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);return D[0]===255?"big":D[0]===204?"little":"unknown"}();const C=function(v){const D={};return Object.keys(v).forEach(L=>{const O=v[L];S(O)?D[L]={bytes:O.buffer,byteOffset:O.byteOffset,byteLength:O.byteLength}:D[L]=O}),D};self.onmessage=function(v){const D=v.data,L=new Uint8Array(D.encrypted.bytes,D.encrypted.byteOffset,D.encrypted.byteLength),O=new Uint32Array(D.key.bytes,D.key.byteOffset,D.key.byteLength/4),U=new Uint32Array(D.iv.bytes,D.iv.byteOffset,D.iv.byteLength/4);new u(L,O,U,function(F,N){self.postMessage(C({source:D.source,decrypted:N}),[N.buffer])})}}));var Zw=Lm(Jw);const e2=i=>{let e=i.default?"main":"alternative";return i.characteristics&&i.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Xm=(i,e)=>{i.abort(),i.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},_l=(i,e)=>{e.activePlaylistLoader=i,i.load()},t2=(i,e)=>()=>{const{segmentLoaders:{[i]:t,main:r},mediaTypes:{[i]:n}}=e,s=n.activeTrack(),a=n.getActiveGroup(),l=n.activePlaylistLoader,u=n.lastGroup_;if(!(a&&u&&a.id===u.id)&&(n.lastGroup_=a,n.lastTrack_=s,Xm(t,n),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){l&&r.resetEverything();return}t.resyncLoader(),_l(a.playlistLoader,n)}},i2=(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:r}}=e;r.lastGroup_=null,t.abort(),t.pause()},r2=(i,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[i]:r,main:n},mediaTypes:{[i]:s}}=e,a=s.activeTrack(),l=s.getActiveGroup(),u=s.activePlaylistLoader,p=s.lastTrack_;if(!(p&&a&&p.id===a.id)&&(s.lastGroup_=l,s.lastTrack_=a,Xm(r,s),!!l)){if(l.isMainPlaylist){if(!a||!p||a.id===p.id)return;const g=e.vhs.playlistController_,b=g.selectPlaylist();if(g.media()===b)return;s.logger_(`track change. Switching main audio from ${p.id} to ${a.id}`),t.pause(),n.resetEverything(),g.fastQualityChange_(b);return}if(i==="AUDIO"){if(!l.playlistLoader){n.setAudio(!0),n.resetEverything();return}r.setAudio(!0),n.setAudio(!1)}if(u===l.playlistLoader){_l(l.playlistLoader,s);return}r.track&&r.track(a),r.resetEverything(),_l(l.playlistLoader,s)}},_a={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:t},excludePlaylist:r}=e,n=t.activeTrack(),s=t.activeGroup(),a=(s.filter(u=>u.default)[0]||s[0]).id,l=t.tracks[a];if(n===l){r({error:{message:"Problem encountered loading the default audio track."}});return}B.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const u in t.tracks)t.tracks[u].enabled=t.tracks[u]===l;t.onTrackChanged()},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:t}}=e;B.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=t.activeTrack();r&&(r.mode="disabled"),t.onTrackChanged()}},ch={AUDIO:(i,e,t)=>{if(!e)return;const{tech:r,requestOptions:n,segmentLoaders:{[i]:s}}=t;e.on("loadedmetadata",()=>{const a=e.media();s.playlist(a,n),(!r.paused()||a.endList&&r.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),n),r.paused()||s.load()}),e.on("error",_a[i](i,t))},SUBTITLES:(i,e,t)=>{const{tech:r,requestOptions:n,segmentLoaders:{[i]:s},mediaTypes:{[i]:a}}=t;e.on("loadedmetadata",()=>{const l=e.media();s.playlist(l,n),s.track(a.activeTrack()),(!r.paused()||l.endList&&r.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),n),r.paused()||s.load()}),e.on("error",_a[i](i,t))}},n2={AUDIO:(i,e)=>{const{vhs:t,sourceType:r,segmentLoaders:{[i]:n},requestOptions:s,main:{mediaGroups:a},mediaTypes:{[i]:{groups:l,tracks:u,logger_:p}},mainPlaylistLoader:g}=e,b=ts(g.main);(!a[i]||Object.keys(a[i]).length===0)&&(a[i]={main:{default:{default:!0}}},b&&(a[i].main.default.playlists=g.main.playlists));for(const S in a[i]){l[S]||(l[S]=[]);for(const w in a[i][S]){let C=a[i][S][w],v;if(b?(p(`AUDIO group '${S}' label '${w}' is a main playlist`),C.isMainPlaylist=!0,v=null):r==="vhs-json"&&C.playlists?v=new Er(C.playlists[0],t,s):C.resolvedUri?v=new Er(C.resolvedUri,t,s):C.playlists&&r==="dash"?v=new pl(C.playlists[0],t,s,g):v=null,C=fe({id:w,playlistLoader:v},C),ch[i](i,C.playlistLoader,e),l[S].push(C),typeof u[w]>"u"){const D=new B.AudioTrack({id:w,kind:e2(C),enabled:!1,language:C.language,default:C.default,label:w});u[w]=D}}}n.on("error",_a[i](i,e))},SUBTITLES:(i,e)=>{const{tech:t,vhs:r,sourceType:n,segmentLoaders:{[i]:s},requestOptions:a,main:{mediaGroups:l},mediaTypes:{[i]:{groups:u,tracks:p}},mainPlaylistLoader:g}=e;for(const b in l[i]){u[b]||(u[b]=[]);for(const S in l[i][b]){if(!r.options_.useForcedSubtitles&&l[i][b][S].forced)continue;let w=l[i][b][S],C;if(n==="hls")C=new Er(w.resolvedUri,r,a);else if(n==="dash"){if(!w.playlists.filter(v=>v.excludeUntil!==1/0).length)return;C=new pl(w.playlists[0],r,a,g)}else n==="vhs-json"&&(C=new Er(w.playlists?w.playlists[0]:w.resolvedUri,r,a));if(w=fe({id:S,playlistLoader:C},w),ch[i](i,w.playlistLoader,e),u[b].push(w),typeof p[S]>"u"){const v=t.addRemoteTextTrack({id:S,kind:"subtitles",default:w.default&&w.autoselect,language:w.language,label:S},!1).track;p[S]=v}}}s.on("error",_a[i](i,e))},"CLOSED-CAPTIONS":(i,e)=>{const{tech:t,main:{mediaGroups:r},mediaTypes:{[i]:{groups:n,tracks:s}}}=e;for(const a in r[i]){n[a]||(n[a]=[]);for(const l in r[i][a]){const u=r[i][a][l];if(!/^(?:CC|SERVICE)/.test(u.instreamId))continue;const p=t.options_.vhs&&t.options_.vhs.captionServices||{};let g={label:l,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(p[g.instreamId]&&(g=fe(g,p[g.instreamId])),g.default===void 0&&delete g.default,n[a].push(fe({id:l},u)),typeof s[l]>"u"){const b=t.addRemoteTextTrack({id:g.instreamId,kind:"captions",default:g.default,language:g.language,label:g.label},!1).track;s[l]=b}}}}},Km=(i,e)=>{for(let t=0;t<i.length;t++)if(Eu(e,i[t])||i[t].playlists&&Km(i[t].playlists,e))return!0;return!1},s2=(i,e)=>t=>{const{mainPlaylistLoader:r,mediaTypes:{[i]:{groups:n}}}=e,s=r.media();if(!s)return null;let a=null;s.attributes[i]&&(a=n[s.attributes[i]]);const l=Object.keys(n);if(!a)if(i==="AUDIO"&&l.length>1&&ts(e.main))for(let u=0;u<l.length;u++){const p=n[l[u]];if(Km(p,s)){a=p;break}}else n.main?a=n.main:l.length===1&&(a=n[l[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(u=>u.id===t.id)[0]||null},a2={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}},o2=(i,{mediaTypes:e})=>()=>{const t=e[i].activeTrack();return t?e[i].activeGroup(t):null},l2=i=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(p=>{n2[p](p,i)});const{mediaTypes:e,mainPlaylistLoader:t,tech:r,vhs:n,segmentLoaders:{["AUDIO"]:s,main:a}}=i;["AUDIO","SUBTITLES"].forEach(p=>{e[p].activeGroup=s2(p,i),e[p].activeTrack=a2[p](p,i),e[p].onGroupChanged=t2(p,i),e[p].onGroupChanging=i2(p,i),e[p].onTrackChanged=r2(p,i),e[p].getActiveGroup=o2(p,i)});const l=e.AUDIO.activeGroup();if(l){const p=(l.filter(g=>g.default)[0]||l[0]).id;e.AUDIO.tracks[p].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),s.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(p=>e[p].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(p=>e[p].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),n.on("dispose",()=>{r.audioTracks().removeEventListener("change",u),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const p in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[p])},u2=()=>{const i={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:pi,activeTrack:pi,getActiveGroup:pi,onGroupChanged:pi,onTrackChanged:pi,lastTrack_:null,logger_:Nt(`MediaGroups[${e}]`)}}),i};class dh{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=yt(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class c2 extends B.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new dh,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Nt("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const 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=yt(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 n={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:n}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(s,a)=>{if(s){if(a.status===410){this.logger_(`manifest request 410 ${s}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(a.status===429){const p=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${s}.`),this.logger_(`content steering will retry in ${p} seconds.`),this.startTTLTimeout_(parseInt(p,10));return}this.logger_(`manifest failed to load ${s}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:n});let l;try{l=JSON.parse(this.request_.responseText)}catch(p){const g={errorType:B.Error.StreamingContentSteeringParserError,error:p};this.trigger({type:"error",metadata:g})}this.assignSteeringProperties_(l);const u={contentSteeringInfo:n.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 x.URL(e),r=new x.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const t=JSON.parse(x.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new x.URL(e),r=this.getPathway(),n=this.getBandwidth_();if(r){const s=`_${this.manifestType_}_pathway`;t.searchParams.set(s,r)}if(n){const s=`_${this.manifestType_}_throughput`;t.searchParams.set(s,n)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const t=(r=>{for(const n of r)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=n=>this.excludedSteeringManifestURLs.has(n);if(this.proxyServerUrl_){const n=this.setProxyServerUrl_(e);if(!t(n))return n}const r=this.setSteeringParams_(e);return t(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=x.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){x.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 dh}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(yt(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const d2=(i,e)=>{let t=null;return(...r)=>{clearTimeout(t),t=setTimeout(()=>{i.apply(null,r)},e)}},h2=10;let Pi;const p2=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],g2=function(i){return this.audioSegmentLoader_[i]+this.mainSegmentLoader_[i]},m2=function({currentPlaylist:i,buffered:e,currentTime:t,nextPlaylist:r,bufferLowWaterLine:n,bufferHighWaterLine:s,duration:a,bufferBasedABR:l,log:u}){if(!r)return B.log.warn("We received no playlist to switch to. Please check your stream."),!1;const p=`allowing switch ${i&&i.id||"null"} -> ${r.id}`;if(!i)return u(`${p} as current playlist is not set`),!0;if(r.id===i.id)return!1;const g=!!Sr(e,t).length;if(!i.endList)return!g&&typeof i.partTargetDuration=="number"?(u(`not ${p} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(u(`${p} as current playlist is live`),!0);const b=vu(e,t),S=l?Xe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Xe.MAX_BUFFER_LOW_WATER_LINE;if(a<S)return u(`${p} as duration < max low water line (${a} < ${S})`),!0;const w=r.attributes.BANDWIDTH,C=i.attributes.BANDWIDTH;if(w<C&&(!l||b<s)){let v=`${p} as next bandwidth < current bandwidth (${w} < ${C})`;return l&&(v+=` and forwardBuffer < bufferHighWaterLine (${b} < ${s})`),u(v),!0}if((!l||w>C)&&b>=n){let v=`${p} as forwardBuffer >= bufferLowWaterLine (${b} >= ${n})`;return l&&(v+=` and next bandwidth > current bandwidth (${w} > ${C})`),u(v),!0}return u(`not ${p} as no switching criteria met`),!1};class f2 extends B.EventTarget{constructor(e){super(),this.fastQualityChange_=d2(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:r,tech:n,bandwidth:s,externVhs:a,useCueTags:l,playlistExclusionDuration:u,enableLowInitialPlaylist:p,sourceType:g,cacheEncryptionKeys:b,bufferBasedABR:S,leastPixelDiffSelector:w,captionServices:C,experimentalUseMMS:v}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:D}=e;(D===null||typeof D>"u")&&(D=1/0),Pi=a,this.bufferBasedABR=!!S,this.leastPixelDiffSelector=!!w,this.withCredentials=r,this.tech_=n,this.vhs_=n.vhs,this.player_=e.player_,this.sourceType_=g,this.useCueTags_=l,this.playlistExclusionDuration=u,this.maxPlaylistRetries=D,this.enableLowInitialPlaylist=p,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:D,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=u2(),v&&x.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new x.ManagedMediaSource,this.usingManagedMediaSource_=!0,B.log("Using ManagedMediaSource")):x.MediaSource&&(this.mediaSource=new x.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=it(),this.hasPlayed_=!1,this.syncController_=new Yw(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Zw,this.sourceUpdater_=new Wm(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Qw,this.keyStatusMap_=new Map;const L={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:C,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:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:b,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new pl(t,this.vhs_,fe(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Er(t,this.vhs_,fe(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new fl(fe(L,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new fl(fe(L,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new zw(fe(L,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((F,N)=>{function V(){n.off("vttjserror",J),F()}function J(){n.off("vttjsloaded",V),N()}n.one("vttjsloaded",V),n.one("vttjserror",J),n.addWebVttScript_()})}),e);const O=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new c2(this.vhs_.xhr,O),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),p2.forEach(F=>{this[F+"_"]=g2.bind(this,F)}),this.logger_=Nt("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const U=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(U,()=>{const F=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-F,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,r){const n=this.media(),s=n&&(n.id||n.uri),a=e&&(e.id||e.uri);if(s&&s!==a){this.logger_(`switch media ${s} -> ${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,n=this.contentSteeringController_.getPathway();if(r&&n){const s=(r.length?r[0].playlists:r.playlists).filter(a=>a.attributes.serviceLocation===n);s.length&&this.mediaTypes_[e].activePlaylistLoader.media(s[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=x.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(x.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,n=Object.keys(r);let s;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)s=this.mediaTypes_.AUDIO.activeTrack();else{const l=r.main||n.length&&r[n[0]];for(const u in l)if(l[u].default){s={label:u};break}}if(!s)return t;const a=[];for(const l in r)if(r[l][s.label]){const u=r[l][s.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 p=0;p<e.playlists.length;p++){const g=e.playlists[p];g.attributes&&g.attributes.AUDIO&&g.attributes.AUDIO===l&&a.push(g)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ll(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),l2({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let t;if(this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ll(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();e.lastExcludeReason_!=="playlist-unchanged"&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(e=>{this.mainPlaylistLoader_.on(e,t=>{this.player_.trigger(Ve({},t))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const r=e.mediaGroups||{};let n=!0;const s=Object.keys(r.AUDIO);for(const a in r.AUDIO)for(const l in r.AUDIO[a])r.AUDIO[a][l].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Pi.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(r.AUDIO[s[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(),n=this.bufferLowWaterLine(),s=this.bufferHighWaterLine(),a=this.tech_.buffered();return m2({buffered:a,currentTime:r,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:s,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const t=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const t=this.audioSegmentLoader_.pendingSegment_;if(!t||!t.segment||!t.segment.syncInfo)return;const r=t.segment.syncInfo.end+.01;this.tech_.setCurrentTime(r)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",t=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:h2}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const t=this.getCodecsOrExclude_();t&&this.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(t=>{this.mainSegmentLoader_.on(t,r=>{this.player_.trigger(Ve({},r))}),this.audioSegmentLoader_.on(t,r=>{this.player_.trigger(Ve({},r))}),this.subtitleSegmentLoader_.on(t,r=>{this.player_.trigger(Ve({},r))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const r=t.end(0);let n=r;if(e.start){const s=e.start.timeOffset;s<0?n=Math.max(r+s,t.start(0)):n=Math.min(r,s)}this.trigger("firstplay"),this.tech_.setCurrentTime(n)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const t=this.syncController_.getExpiredTime(e,this.duration());if(t===null)return!1;const r=Pi.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return r-n<=ei;const a=s.end(s.length-1);return a-n<=ei&&r-a<=ei}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 n=this.mainPlaylistLoader_.main.playlists,s=n.filter(Ga),a=s.length===1&&s[0]===e;if(n.length===1&&r!==1/0)return B.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const C=this.pathwayAttribute_(e),v=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(C),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(C)},v);return}let w=!1;n.forEach(C=>{if(C===e)return;const v=C.excludeUntil;typeof v<"u"&&v!==1/0&&(w=!0,delete C.excludeUntil)}),w&&(B.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+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 p=t.internal?this.logger_:B.log.warn,g=t.message?" "+t.message:"";p(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${g} 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 b=u.targetDuration/2*1e3||5*1e3,S=typeof u.lastRequest=="number"&&Date.now()-u.lastRequest<=b;return this.switchMedia_(u,"exclude",a||S)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const r=[],n=e==="all";(n||e==="main")&&r.push(this.mainPlaylistLoader_);const s=[];(n||e==="audio")&&s.push("AUDIO"),(n||e==="subtitle")&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.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=Sr(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:Pi.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const r=e.media();if(!r)return null;const n=this.syncController_.getMediaSequenceSync(t);if(n&&n.isReliable){const l=n.start,u=n.end;if(!isFinite(l)||!isFinite(u))return null;const p=Pi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r),g=Math.max(0,u-p);return g<l?null:it([[l,g]])}const s=this.syncController_.getExpiredTime(r,this.duration());if(s===null)return null;const a=Pi.Playlist.seekable(r,s,Pi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const r=e.start(0),n=e.end(0),s=t.start(0),a=t.end(0);return s>n||r>a?e:it([[Math.max(r,s),Math.min(n,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const 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 [${am(this.seekable_)}]`);const n={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:n}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const n=this.seekable();if(!n.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<n.end(n.length-1))&&this.sourceUpdater_.setDuration(n.end(n.length-1));return}const t=this.tech_.buffered();let r=Pi.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(n=>{n.playlistLoader&&n.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),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=Un(this.main(),t),n={},s=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=r.video||e.main.videoCodec||aT),e.main.isMuxed&&(n.video+=`,${r.audio||e.main.audioCodec||ad}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||s)&&(n.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||ad,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(p,g)=>p?Dn(g,this.usingManagedMediaSource_):ko(g),l={};let u;if(["video","audio"].forEach(function(p){if(n.hasOwnProperty(p)&&!a(e[p].isFmp4,n[p])){const g=e[p].isFmp4?"browser":"muxer";l[g]=l[g]||[],l[g].push(n[p]),p==="audio"&&(u=g)}}),s&&u&&t.attributes.AUDIO){const p=t.attributes.AUDIO;this.main().playlists.forEach(g=>{(g.attributes&&g.attributes.AUDIO)===p&&g!==t&&(g.excludeUntil=1/0)}),this.logger_(`excluding audio group ${p} as ${u} does not support codec(s): "${n.audio}"`)}if(Object.keys(l).length){const p=Object.keys(l).reduce((g,b)=>(g&&(g+=", "),g+=`${b} does not support codec(s): "${l[b].join(",")}"`,g),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:p},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const p=[];if(["video","audio"].forEach(g=>{const b=(Kt(this.sourceUpdater_.codecs[g]||"")[0]||{}).type,S=(Kt(n[g]||"")[0]||{}).type;b&&S&&b.toLowerCase()!==S.toLowerCase()&&p.push(`"${this.sourceUpdater_.codecs[g]}" -> "${n[g]}"`)}),p.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${p.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return n}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(r=>{const n=e[r];if(t.indexOf(n.id)!==-1)return;t.push(n.id);const s=Un(this.main,n),a=[];s.audio&&!ko(s.audio)&&!Dn(s.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${s.audio}`),s.video&&!ko(s.video)&&!Dn(s.video,this.usingManagedMediaSource_)&&a.push(`video codec ${s.video}`),s.text&&s.text==="stpp.ttml.im1t"&&a.push(`text codec ${s.text}`),a.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],r=this.main().playlists,n=fa(Kt(e)),s=Jd(n),a=n.video&&Kt(n.video)[0]||null,l=n.audio&&Kt(n.audio)[0]||null;Object.keys(r).forEach(u=>{const p=r[u];if(t.indexOf(p.id)!==-1||p.excludeUntil===1/0)return;t.push(p.id);const g=[],b=Un(this.mainPlaylistLoader_.main,p),S=Jd(b);if(!(!b.audio&&!b.video)){if(S!==s&&g.push(`codec count "${S}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){const w=b.video&&Kt(b.video)[0]||null,C=b.audio&&Kt(b.audio)[0]||null;w&&a&&w.type.toLowerCase()!==a.type.toLowerCase()&&g.push(`video codec "${w.type}" !== "${a.type}"`),C&&l&&C.type.toLowerCase()!==l.type.toLowerCase()&&g.push(`audio codec "${C.type}" !== "${l.type}"`)}g.length&&(p.excludeUntil=1/0,this.logger_(`excluding ${p.id}: ${g.join(" && ")}`))}})}updateAdCues_(e){let t=0;const r=this.seekable();r.length&&(t=r.start(0)),Gw(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Xe.GOAL_BUFFER_LENGTH,r=Xe.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Xe.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*r,n)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Xe.BUFFER_LOW_WATER_LINE,r=Xe.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Xe.MAX_BUFFER_LOW_WATER_LINE),s=Math.max(t,Xe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*r,this.bufferBasedABR?s:n)}bufferHighWaterLine(){return Xe.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){th(this.inbandTextTracks_,"com.apple.streaming",this.tech_),Cw({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,r){const n=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();th(this.inbandTextTracks_,e,this.tech_),Ew({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,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(e=>{this.contentSteeringController_.on(e,t=>{this.trigger(Ve({},t))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const t=this.contentSteeringController_.getAvailablePathways(),r=[];for(const n of e.playlists){const s=n.attributes.serviceLocation;if(s&&(r.push(s),!t.has(s)))return!0}return!!(!r.length&&t.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const t=this.main().playlists,r=new Set;let n=!1;Object.keys(t).forEach(s=>{const a=t[s],l=this.pathwayAttribute_(a),u=l&&e!==l;a.excludeUntil===1/0&&a.lastExcludeReason_==="content-steering"&&!u&&(delete a.excludeUntil,delete a.lastExcludeReason_,n=!0);const p=!a.excludeUntil&&a.excludeUntil!==1/0;!r.has(a.id)&&u&&p&&(r.add(a.id),a.excludeUntil=1/0,a.lastExcludeReason_="content-steering",this.logger_(`excluding ${a.id} for ${a.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(s=>{const a=this.mediaTypes_[s];if(a.activePlaylistLoader){const l=a.activePlaylistLoader.media_;l&&l.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,r=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||r&&r.size){for(const[n,s]of t.entries())r.get(n)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(n));for(const[n,s]of r.entries()){const a=t.get(n);if(!a){e.filter(l=>l.attributes["PATHWAY-ID"]===s["BASE-ID"]).forEach(l=>{this.mainPlaylistLoader_.addClonePathway(s,l)}),this.contentSteeringController_.addAvailablePathway(n);continue}this.equalPathwayClones_(a,s)||(this.mainPlaylistLoader_.updateOrDeleteClone(s,!0),this.contentSteeringController_.addAvailablePathway(n))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...r])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(const s in r)if(r[s]!==n[s])return!1;for(const s in n)if(r[s]!==n[s])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 n=this.mainPlaylistLoader_.getKeyIdSet(r);!n||!n.size||n.forEach(s=>{const a="usable",l=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)===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 ${s} 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 ${s} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const n=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,s=r.excludeUntil===1/0&&r.lastExcludeReason_===t;n&&s&&(delete r.excludeUntil,B.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const r=(typeof e=="string"?e:Vw(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${r} added to the keyStatusMap`),this.keyStatusMap_.set(r,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const y2=(i,e,t)=>r=>{const n=i.main.playlists[e],s=Su(n),a=Ga(n);if(typeof r>"u")return a;r?delete n.disabled:n.disabled=!0;const l={renditionInfo:{id:e,bandwidth:n.attributes.BANDWIDTH,resolution:n.attributes.RESOLUTION,codecs:n.attributes.CODECS},cause:"fast-quality"};return r!==a&&!s&&(r?(t(n),i.trigger({type:"renditionenabled",metadata:l})):i.trigger({type:"renditiondisabled",metadata:l})),r};class _2{constructor(e,t,r){const{playlistController_:n}=e,s=n.fastQualityChange_.bind(n);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=Un(n.main(),t),this.playlist=t,this.id=r,this.enabled=y2(e.playlists,t.id,s)}}const b2=function(i){i.representations=()=>{const e=i.playlistController_.main(),t=ts(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(r=>!Su(r)).map((r,n)=>new _2(i,r,r.id)):[]}},hh=["seeking","seeked","pause","playing","error"];class v2 extends B.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Nt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),a=this.playlistController_,l=["main","subtitle","audio"],u={};l.forEach(g=>{u[g]={reset:()=>this.resetSegmentDownloads_(g),updateend:()=>this.checkSegmentDownloads_(g)},a[`${g}SegmentLoader_`].on("appendsdone",u[g].updateend),a[`${g}SegmentLoader_`].on("playlistupdate",u[g].reset),this.tech_.on(["seeked","seeking"],u[g].reset)});const p=g=>{["main","audio"].forEach(b=>{a[`${b}SegmentLoader_`][g]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),p("off"))},this.clearSeekingAppendCheck_=()=>p("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),p("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(hh,s),this.tech_.on("canplay",r),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(hh,s),this.tech_.off("canplay",r),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(g=>{a[`${g}SegmentLoader_`].off("appendsdone",u[g].updateend),a[`${g}SegmentLoader_`].off("playlistupdate",u[g].reset),this.tech_.off(["seeked","seeking"],u[g].reset)}),this.checkCurrentTimeTimeout_&&x.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&x.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=x.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_`],n=r.buffered_(),s=nE(this[`${e}Buffered_`],n);if(this[`${e}Buffered_`]=n,s){const a={bufferedRanges:n};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:Qi(n)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+ei>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(it([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 e=this.seekable(),t=this.tech_.currentTime(),r=this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(r&&(n=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)){const w=e.start(0);n=w+(w===e.end(0)?0:ei)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${am(e)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const s=this.playlistController_.sourceUpdater_,a=this.tech_.buffered(),l=s.audioBuffer?s.audioBuffered():null,u=s.videoBuffer?s.videoBuffered():null,p=this.media(),g=p.partTargetDuration?p.partTargetDuration:(p.targetDuration-Zt)*2,b=[l,u];for(let w=0;w<b.length;w++)if(b[w]&&vu(b[w],t)<g)return!1;const S=Ms(a,t);return S.length===0?!1:(n=S.start(0)+ei,this.logger_(`Buffered region starts (${S.start(0)}) just beyond seek point (${t}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),r=Sr(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 a=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${a}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(a),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,n=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 s=Ms(n,t);return s.length>0?(this.logger_(`Stopped at ${t} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,r,n=!1){if(!e.length)return!1;let s=e.end(e.length-1)+ei;const a=!r.endList,l=typeof r.partTargetDuration=="number";return a&&(l||n)&&(s=e.end(e.length-1)+r.targetDuration*3),t>s}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 n;if(e.length&&t.length){const s=Sr(e,r-3),a=Sr(e,r),l=Sr(t,r);l.length&&!a.length&&s.length&&(n={start:s.end(0),end:l.end(0)})}else Ms(e,r).length||(n=this.gapFromVideoUnderflow_(e,r));return n?(this.logger_(`Encountered a gap in video from ${n.start} to ${n.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),r=this.tech_.currentTime(),n=Ms(t,r);if(this.resetTimeUpdate_(),n.length===0||r!==e)return;this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+Zt);const s={gapInfo:{from:r,to:n.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:s}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const r=tE(e);for(let n=0;n<r.length;n++){const s=r.start(n),a=r.end(n);if(t-s<4&&t-s>2)return{start:s,end:a}}return null}}const T2={errorInterval:30,getSource(i){const e=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return i(e)}},Ym=function(i,e){let t=0,r=0;const n=fe(T2,e);i.ready(()=>{i.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const s=function(){r&&i.currentTime(r)},a=function(g){g!=null&&(r=i.duration()!==1/0&&i.currentTime()||0,i.one("loadedmetadata",s),i.src(g),i.trigger({type:"usage",name:"vhs-error-reload"}),i.play())},l=function(){if(Date.now()-t<n.errorInterval*1e3){i.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!n.getSource||typeof n.getSource!="function"){B.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),n.getSource.call(i,a)},u=function(){i.off("loadedmetadata",s),i.off("error",l),i.off("dispose",u)},p=function(g){u(),Ym(i,g)};i.on("error",l),i.on("dispose",u),i.reloadSourceOnError=p},S2=function(i){Ym(this,i)};var Qm="3.16.2",E2="7.1.0",w2="1.3.1",k2="7.2.0",C2="4.0.2";const Ne={PlaylistLoader:Er,Playlist:_t,utils:AE,STANDARD_PLAYLIST_SELECTOR:eh,INITIAL_PLAYLIST_SELECTOR:_w,lastBandwidthSelector:eh,movingAverageBandwidthSelector:fw,comparePlaylistBandwidth:ku,comparePlaylistResolution:mw,xhr:Em()};Object.keys(Xe).forEach(i=>{Object.defineProperty(Ne,i,{get(){return B.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),Xe[i]},set(e){if(B.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){B.log.warn(`value of Vhs.${i} must be greater than or equal to 0`);return}Xe[i]=e}})});const Jm="videojs-vhs",Zm=function(i,e){const t=e.media();let r=-1;for(let n=0;n<i.length;n++)if(i[n].id===t.id){r=n;break}i.selectedIndex_=r,i.trigger({selectedIndex:r,type:"change"})},I2=function(i,e){e.representations().forEach(t=>{i.addQualityLevel(t)}),Zm(i,e.playlists)};Ne.canPlaySource=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const A2=(i,e,t)=>{if(!i)return i;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=fa(Kt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(r.audio=t.attributes.CODECS);const n=Or(r.video),s=Or(r.audio),a={};for(const l in i)a[l]={},s&&(a[l].audioContentType=s),n&&(a[l].videoContentType=n),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 fe(i,a)},x2=(i,e)=>i.reduce((t,r)=>{if(!r.contentProtection)return t;const n=e.reduce((s,a)=>{const l=r.contentProtection[a];return l&&l.pssh&&(s[a]={pssh:l.pssh}),s},{});return Object.keys(n).length&&t.push(n),t},[]),L2=({player:i,sourceKeySystems:e,audioMedia:t,mainPlaylists:r})=>{if(!i.eme.initializeMediaKeys)return Promise.resolve();const n=t?r.concat([t]):r,s=x2(n,Object.keys(e)),a=[],l=[];return s.forEach(u=>{l.push(new Promise((p,g)=>{i.tech_.one("keysessioncreated",p)})),a.push(new Promise((p,g)=>{i.eme.initializeMediaKeys({keySystems:u},b=>{if(b){g(b);return}p()})}))}),Promise.race([Promise.all(a),Promise.race(l)])},D2=({player:i,sourceKeySystems:e,media:t,audioMedia:r})=>{const n=A2(e,t,r);return n?(i.currentSource().keySystems=n,n&&!i.eme?(B.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},ef=()=>{if(!x.localStorage)return null;const i=x.localStorage.getItem(Jm);if(!i)return null;try{return JSON.parse(i)}catch{return null}},P2=i=>{if(!x.localStorage)return!1;let e=ef();e=e?fe(e,i):i;try{x.localStorage.setItem(Jm,JSON.stringify(e))}catch{return!1}return e},R2=i=>i.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(i.substring(i.indexOf(",")+1)):i,tf=(i,e)=>{i._requestCallbackSet||(i._requestCallbackSet=new Set),i._requestCallbackSet.add(e)},rf=(i,e)=>{i._responseCallbackSet||(i._responseCallbackSet=new Set),i._responseCallbackSet.add(e)},nf=(i,e)=>{i._requestCallbackSet&&(i._requestCallbackSet.delete(e),i._requestCallbackSet.size||delete i._requestCallbackSet)},sf=(i,e)=>{i._responseCallbackSet&&(i._responseCallbackSet.delete(e),i._responseCallbackSet.size||delete i._responseCallbackSet)};Ne.supportsNativeHls=function(){if(!G||!G.createElement)return!1;const i=G.createElement("video");return B.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(i.canPlayType(e))}):!1}();Ne.supportsNativeDash=function(){return!G||!G.createElement||!B.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(G.createElement("video").canPlayType("application/dash+xml"))}();Ne.supportsTypeNatively=i=>i==="hls"?Ne.supportsNativeHls:i==="dash"?Ne.supportsNativeDash:!1;Ne.isSupported=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Ne.xhr.onRequest=function(i){tf(Ne.xhr,i)};Ne.xhr.onResponse=function(i){rf(Ne.xhr,i)};Ne.xhr.offRequest=function(i){nf(Ne.xhr,i)};Ne.xhr.offResponse=function(i){sf(Ne.xhr,i)};const N2=B.getComponent("Component");class af extends N2{constructor(e,t,r){if(super(t,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=Nt("VhsHandler"),t.options_&&t.options_.playerId){const n=B.getPlayer(t.options_.playerId);this.player_=n}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(G,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],n=>{const s=G.fullscreenElement||G.webkitFullscreenElement||G.mozFullScreenElement||G.msFullscreenElement;s&&s.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_=fe(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=ef();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=Xe.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Xe.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=R2(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Ne,this.options_.sourceType=kp(t),this.options_.seekTo=s=>{this.tech_.setCurrentTime(s)},this.options_.player_=this.player_,this.playlistController_=new f2(this.options_);const r=fe({liveRangeSafeTimeDelta:ei},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new v2(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const s=B.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),s.error(a)});const n=this.options_.bufferBasedABR?Ne.movingAverageBandwidthSelector(.55):Ne.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=Ne.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(s){this.playlistController_.selectPlaylist=s.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(s){this.playlistController_.mainSegmentLoader_.throughput.rate=s,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let s=this.playlistController_.mainSegmentLoader_.bandwidth;const a=x.navigator.connection||x.navigator.mozConnection||x.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&a){const u=a.downlink*1e3*1e3;u>=l&&s>=l?s=Math.max(s,u):s=u}return s},set(s){this.playlistController_.mainSegmentLoader_.bandwidth=s,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const s=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(s+a))},set(){B.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>Qi(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>Qi(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&P2({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{b2(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_=x.URL.createObjectURL(this.playlistController_.mediaSource),(B.browser.IS_ANY_SAFARI||B.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),L2({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=D2({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=B.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{I2(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Zm(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Qm,"mux.js":E2,"mpd-parser":w2,"m3u8-parser":k2,"aes-decrypter":C2}}version(){return this.constructor.version()}canChangeType(){return Wm.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_&&x.URL.revokeObjectURL&&(x.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return OE({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,r=!0,n=2){return Am({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{tf(this.xhr,e)},this.xhr.onResponse=e=>{rf(this.xhr,e)},this.xhr.offRequest=e=>{nf(this.xhr,e)},this.xhr.offResponse=e=>{sf(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,n=>{this.player_.trigger(Ve({},n))})}),t.forEach(r=>{this.playbackWatcher_.on(r,n=>{this.player_.trigger(Ve({},n))})})}}const ba={name:"videojs-http-streaming",VERSION:Qm,canHandleSource(i,e={}){const t=fe(B.options,e);return!t.vhs.experimentalUseMMS&&!Dn("avc1.4d400d,mp4a.40.2",!1)?!1:ba.canPlayType(i.type,t)},handleSource(i,e,t={}){const r=fe(B.options,t);return e.vhs=new af(i,e,r),e.vhs.xhr=Em(),e.vhs.setupXhrHooks_(),e.vhs.src(i.src,i.type),e.vhs},canPlayType(i,e){const t=kp(i);if(!t)return"";const r=ba.getOverrideNative(e);return!Ne.supportsTypeNatively(t)||r?"maybe":""},getOverrideNative(i={}){const{vhs:e={}}=i,t=!(B.browser.IS_ANY_SAFARI||B.browser.IS_IOS),{overrideNative:r=t}=e;return r}},O2=()=>Dn("avc1.4d400d,mp4a.40.2",!0);O2()&&B.getTech("Html5").registerSourceHandler(ba,0);B.VhsHandler=af;B.VhsSourceHandler=ba;B.Vhs=Ne;B.use||B.registerComponent("Vhs",Ne);B.options.vhs=B.options.vhs||{};(!B.getPlugin||!B.getPlugin("reloadSourceOnError"))&&B.registerPlugin("reloadSourceOnError",S2);const U2=i=>{const e=Me.useRef();return Me.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=B(t,{controls:!1,playsinline:!0})}return()=>{e.current&&(e.current.dispose(),e.current=void 0)}},[]),e},of={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},De=X.i(of),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)},M2=(i,e)=>{const t=db(i,e),r=U2(i),n=Me.useRef(),s=Me.useCallback(()=>{var p,g;const{adPosition:b,adCount:S}=De.get();if(r.current){if(b<S){const w=b+1,{ads:C,muted:v,autoplay:D}=t.get(),L=C[w-1];if(L){(p=n.current)==null||p.complete(),n.current=new ib(null,L.ad,L.creative),n.current.on("clickthrough",O=>{window.open(O,"_blank")}),De.setKey("adPosition",w),De.setKey("playMuted",v),De.setKey("skipDelay",L.creative.skipDelay||0),De.setKey("time",0),De.setKey("adAction",O=>{n.current&&n.current.click(null,{CLICKPOS:[O.clientX,O.clientY]})}),De.setKey("whyThisAd",L.creative.icons.find(O=>O.program==="GoogleWhyThisAd")||null),De.setKey("hasAdUrl",!!((g=L.creative.videoClickThroughURLTemplate)!=null&&g.url)),r.current.src(L.mediaFileUrl),De.setKey("playing",!0),b===0?(De.setKey("muted",v),De.setKey("autoplay",D),v&&r.current.muted(!0),D?r.current.play():(r.current.pause(),De.setKey("paused",!0))):r.current.play();return}}De.set(of),r.current.pause(),r.current.src(void 0)}},[r,t]),a=Me.useCallback(()=>{if(!r.current)return;const p=r.current.muted();r.current.muted(!p),De.setKey("muted",!p),n.current&&n.current.setMuted(!p)},[r]),l=Me.useCallback(()=>{r.current&&(r.current.paused()?(r.current.play(),n.current&&n.current.setPaused(!1)):(r.current.pause(),n.current&&n.current.setPaused(!0)))},[r]),u=Me.useCallback(()=>{r.current&&(n.current&&n.current.skip(),s())},[s,r]);return Me.useEffect(()=>{r.current&&(r.current.on("play",p=>{De.setKey("playing",!0),De.setKey("paused",!1),De.setKey("time",ph(p.target.player))}),r.current.on("ended",()=>{s()}),r.current.on("muted",p=>{console.log("muted",p),De.setKey("muted",p.target.player.muted())}),r.current.on("pause",()=>{De.setKey("paused",!0)}),r.current.on("click",function(p){p.target.tagName==="VIDEO"&&(De.get().autoplay||l())}),r.current.on("timeupdate",p=>{De.setKey("time",ph(p.target.player)),n.current&&n.current.setProgress(p.target.player.currentTime())}))},[l,s,r]),Me.useEffect(()=>t.subscribe(p=>{p&&(De.setKey("adCount",p.ads.length),De.setKey("adPosition",0),s())}),[t,r,s]),[De,a,l,u]},B2=({promotion:i,onClose:e,promotionId:t,externalAd:r,skipAutoClose:n})=>{var s,a,l,u,p;const g=Me.useRef(null),[b,S,w,C]=M2(g,r==null?void 0:r.url),{time:v,adCount:D,adPosition:L,skipDelay:O,playing:U,paused:F,reset:N,muted:V,playMuted:J,autoplay:Y,whyThisAd:ie,hasAdUrl:he,adAction:le}=X.useStore(b),pe=((s=i.sponsor)==null?void 0:s.logo)&&i.logoMode===ge.PromotionLogoMode.CENTER;return W.jsxs(yh,{className:"PromoOverlay",children:[W.jsxs(_h,{children:[W.jsx(bh,{className:X.cx_default(!pe&&vh),children:W.jsx(Sh,{style:{transform:"scale(1.5)"},children:"Ad"})}),W.jsxs(B0,{children:[W.jsx(x0,{time:v,adCount:D,adPosition:L}),!!O&&U&&W.jsx(X.y$1,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{C()},duration:O,isPlaying:!F,skipIcon:!0}),n&&W.jsx(X.y$1,{className:"ClosePromoIcon",close:()=>{N(),e==null||e()}})]})]}),W.jsx(Th,{className:X.cx_default(bc,U&&vc,!U&&Tc),children:W.jsxs(M0,{ref:g,children:[ie&&W.jsx(D0,{whyThisAd:ie}),W.jsxs(P0,{style:(ie==null?void 0:ie.xPosition)==="right"?{left:"8px"}:{right:"8px"},children:[J&&W.jsx(N0,{className:X.cx_default(!V&&"muted"),onClick:()=>S()}),F&&!Y&&W.jsx(U0,{onClick:()=>w()})]})]})}),he&&W.jsx(Eh,{className:X.cx_default(bc,U&&vc,!U&&Tc),children:W.jsx(wh,{as:"button",onClick:le,style:{backgroundColor:((l=(a=i.banner)==null?void 0:a.ctaButton)==null?void 0:l.color)||"#009dc4",color:((p=(u=i.banner)==null?void 0:u.ctaButton)==null?void 0:p.textColor)||"#fff"},"data-analytics":"button","data-promo-id":t,"data-promo-type":i.type,target:"_blank",children:"Show more"})})]})},gh=i=>{var e,t,r,n,s,a,l,u,p,g,b,S,w,C,v,D,L,O,U,F,N,V,J,Y,ie,he,le,pe,ee,ce;const{promotion:ne,open:de,advertisementPaused:we,togglePause:ze,controlVideo:dt,skipAutoClose:Ot,promotionId:ht,onClose:Ut,markAsViewed:Vt,externalAd:xe}=i,Fe=ne.type===ge.PromotionType.INGAME_IAB11_LBAR||ne.type===ge.PromotionType.INGAME_IAB11,oi=((e=ne.sponsor)==null?void 0:e.logo)&&ne.logoMode===ge.PromotionLogoMode.CENTER,Fi=!!((r=(t=ne.banner)==null?void 0:t.video)!=null&&r.url),li=ne.autoPlayVideo===ge.AutoPlayVideo.ENABLED;if(Me.useEffect(()=>{ze==null||ze(Fi||li),de==null||de()},[]),Me.useEffect(()=>{ht&&ne.type&&Vt&&Vt()},[ht,ne.type,Vt]),Me.useEffect(()=>()=>{dt==null||dt({muted:!1})},[dt]),xe)return W.jsx(B2,{...i,externalAd:xe});let Ht=(n=ne.banner)==null?void 0:n.url;Ht&&Ht.indexOf("http")!==0&&(Ht=`https://${Ht}`);let Ti=!0;return Fi&&(!we||!li?Ti=!0:Ti=!1),W.jsxs(yh,{className:"PromoOverlay",children:[W.jsxs(_h,{children:[W.jsxs(bh,{className:X.cx_default(!oi&&vh),children:[((s=ne.sponsor)==null?void 0:s.logo)&&ne.logoMode===ge.PromotionLogoMode.LEFT&&W.jsx(fc,{className:"PromoSponsorLogo",src:(a=ne.sponsor)==null?void 0:a.logo,alt:"promo"}),W.jsxs(S0,{style:{paddingLeft:(l=ne.sponsor)!=null&&l.logo&&ne.logoMode===ge.PromotionLogoMode.LEFT?"0px":"8px"},children:[((u=ne.sponsor)==null?void 0:u.logo)&&ne.logoMode===ge.PromotionLogoMode.LEFT&&W.jsx(_0,{children:(p=ne.sponsor)==null?void 0:p.name}),W.jsxs(E0,{className:"SponsorText",children:[W.jsx(Sh,{children:"AD"}),W.jsx(w0,{children:"SPONSORED"})]})]})]}),W.jsx(X.y$1,{className:"ClosePromoIcon",close:Ut,autoClose:(g=ne.closeTimer)==null?void 0:g.auto,duration:Ot?0:(b=ne.closeTimer)==null?void 0:b.seconds,isPlaying:Ti})]}),W.jsxs(Th,{children:[oi&&W.jsx(fc,{className:v0,src:(S=ne.sponsor)==null?void 0:S.logo,alt:"promo"}),W.jsx(yc,{children:(C=(w=ne.banner)==null?void 0:w.video)!=null&&C.url?W.jsx(X.R$1,{source:(D=(v=ne.banner)==null?void 0:v.video)==null?void 0:D.url,poster:(O=(L=ne.banner)==null?void 0:L.video)==null?void 0:O.thumbnailUrl,aspectRatio:Fe?"1/1":"16/9",onPause:()=>{li&&(ze==null||ze(!0))},onPlay:()=>{X.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:ht,type:ne.type}}),ze==null||ze(!1)},controlVideo:dt,autoPlay:li}):(U=ne.banner)!=null&&U.imageUrl?W.jsx(b0,{style:Fe?{aspectRatio:"1/1"}:{},src:(F=ne.banner)==null?void 0:F.imageUrl,alt:"promo"}):null}),!Fe&&W.jsxs(yc,{children:[((N=ne.banner)==null?void 0:N.title)&&W.jsx(k0,{className:X.cx_default("AdvTitle",oi&&C0),children:(V=ne.banner)==null?void 0:V.title}),((J=ne.banner)==null?void 0:J.body)&&W.jsx(T0,{className:"AdvDescription",children:(Y=ne.banner)==null?void 0:Y.body})]})]}),ne.buttonType!==ge.PromotionButtonType.NO_BUTTON&&W.jsx(Eh,{children:W.jsx(wh,{href:Ht,style:{backgroundColor:((he=(ie=ne.banner)==null?void 0:ie.ctaButton)==null?void 0:he.color)||"#009dc4",color:((pe=(le=ne.banner)==null?void 0:le.ctaButton)==null?void 0:pe.textColor)||"#fff"},"data-analytics":"button","data-promo-id":ht,"data-promo-type":ne.type,target:"_blank",children:(ce=(ee=ne.banner)==null?void 0:ee.ctaButton)==null?void 0:ce.label})})]})},F2=X.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),j2=({children:i,direction:e,style:t,className:r,hiding:n})=>W.jsx(bl,{direction:e,style:t,hiding:n,className:r,children:W.jsx(F2,{children:i})}),q2=i=>(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB11_LBAR||(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB21_LBAR,$2=i=>(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB11||(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB21,V2=({advertisement:i,close:e,skipTypeCheck:t,skipAutoClose:r,layoutMode:n="side-by-side",sidebar:s,isNotification:a,banner:l,markAsViewed:u,open:p,externalAd:g,controlVideo:b,advertisementPaused:S,togglePause:w})=>i.promotion?a&&i.notification?W.jsx(f0,{open:()=>p==null?void 0:p({fromNotification:!0}),notification:i.notification,promotionId:i.question.id}):!s&&!l&&(t||$2(i.promotion))?W.jsx(y0,{className:"PromoOverlayContainer",children:W.jsx(gh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,onClose:e,open:p,skipAutoClose:r,externalAd:g,controlVideo:b,advertisementPaused:S,togglePause:w})}):s&&(t||q2(i.promotion))?W.jsx(j2,{className:"PromoSidebarContainer",direction:s,hiding:!1,children:W.jsx(gh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,externalAd:g,onClose:e,open:p,controlVideo:b,skipAutoClose:r,advertisementPaused:S,togglePause:w})}):l?W.jsx(N_,{promotionId:i.question.id,hiding:!1,promotion:i.promotion,direction:l}):null:null,H2=X.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),z2=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")||ge.PromotionType.UNSET;e.getAttribute("data-analytics")==="button"&&X.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:r}}),e.getAttribute("data-analytics")==="banner"&&X.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:r}})}},W2=({gamification:i,layoutMode:e,skipAutoClose:t,skipTypeCheck:r,sidebar:n,banner:s,notification:a,isMobileScreen:l,persistent:u,externalAd:p,controlVideo:g})=>{var b,S,w;const C=Me.useRef(null),v=X.useStore(i.advertisement.$store);X.y(C,{enabled:!!v.data,event:"click",listener:z2});const D=!s&&!n;if(v.data===void 0||!u&&v.isViewed)return null;const L=((w=(S=(b=v==null?void 0:v.data)==null?void 0:b.notification)==null?void 0:S.promotion)==null?void 0:w.mode)===ge.NotificationPromotionMode.LOWER_THIRD;return W.jsx(H2,{ref:C,style:{height:D?"auto":"100%"},className:X.cx_default("SL-AdvertisementUIWrap",l&&"mobile-view",L&&"SL-AdvertisementUIWrap--lower-third"),children:W.jsx(V2,{skipTypeCheck:r,sidebar:n,banner:s,advertisement:v.data,advertisementPaused:v.isPaused,togglePause:v.togglePause,close:v.close,externalAd:p?v.externalAd:void 0,markAsViewed:i.advertisement.markAsViewed,open:i.advertisement.open,layoutMode:e,isNotification:a,skipAutoClose:t,controlVideo:g})})},lf=({sdk:i,sidebar:e,externalAd:t,banner:r,skipAutoClose:n,skipTypeCheck:s,layoutMode:a,isMobileScreen:l,persistent:u,notification:p})=>{const g=X.useStore(i.featuresList.getStore()),[b,S]=Me.useState(!t);if(Me.useEffect(()=>{if(t){const C=document.createElement("script");C.async=!0,C.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(C),C.onload=()=>{S(!0)}}},[t]),e&&r)return W.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(r&&t)return W.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!g)return null;const w=i.getFeature(ge.SdkOverlayType.GAMES);return!w||t&&!b?null:W.jsx(W2,{gamification:w,sidebar:e,banner:r,layoutMode:a,isMobileScreen:l,persistent:u,notification:p,skipTypeCheck:s,skipAutoClose:n,externalAd:t,controlVideo:i.controlVideoPlayer})},G2=({event:i,sidebar:e,banner:t,isMobileScreen:r,skipAutoClose:n,persistent:s,theme:a,notification:l,skipTypeCheck:u,externalAd:p})=>{const g=X.useStreamLayer(),b=X.useStreamLayerUI(),S=X.useStreamLayerTheme();return g?p&&!b.promotionExternalAd?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):!p&&b.promotionExternalAd?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):e&&!b.promotionSidebar?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):t&&!b.promotionBanner?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):l&&!b.promotionNotification?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):!t&&!e&&!l&&!b.promotionOverlay?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):W.jsxs("div",{className:"StreamLayerSDK",children:[W.jsx(X.h,{customTheme:a??S.theme,themeMode:S.themeMode,children:W.jsx(lf,{sdk:g,sidebar:e,banner:t,isMobileScreen:r,persistent:s,notification:l,skipTypeCheck:u,skipAutoClose:n,layoutMode:"side-by-side",externalAd:p})}),i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i})]}):null};exports.StreamLayerSDKAdvertisement=G2;exports.StreamLayerSDKAdvertisementUI=lf;
|
|
223
|
+
`,l++,a=S}),this.end_=a,this.storage_=n,this.diagnostics_=s}calculateBaseTime_(e,t,r){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const n=Math.min(...this.storage_.keys());if(e<n){const s=n-e;let a=this.storage_.get(n).segmentSyncInfo.start;for(let l=0;l<s;l++){const u=t[l];a-=u.duration}return a}return r}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class uh extends Gm{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,r){if(!this.storage_.size){const n=this.parent_.getSyncInfoForMediaSequence(e);return n?n.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,r)}}const Kw=86400,qo=[{name:"VOD",run:(i,e,t,r,n)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(i,e,t,r,n,s)=>{const a=i.getMediaSequenceSync(s);if(!a||!a.isReliable)return null;const l=a.getSyncInfoForTime(n);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(i,e,t,r,n)=>{if(!Object.keys(i.timelineToDatetimeMappings).length)return null;let s=null,a=null;const l=ol(e);n=n||0;for(let u=0;u<l.length;u++){const p=e.endList||n===0?u:l.length-(u+1),g=l[p],b=g.segment,S=i.timelineToDatetimeMappings[b.timeline];if(!S||!b.dateTimeObject)continue;let w=b.dateTimeObject.getTime()/1e3+S;if(b.parts&&typeof g.partIndex=="number")for(let v=0;v<g.partIndex;v++)w+=b.parts[v].duration;const C=Math.abs(n-w);if(a!==null&&(C===0||a<C))break;a=C,s={time:w,segmentIndex:g.segmentIndex,partIndex:g.partIndex}}return s}},{name:"Segment",run:(i,e,t,r,n)=>{let s=null,a=null;n=n||0;const l=ol(e);for(let u=0;u<l.length;u++){const p=e.endList||n===0?u:l.length-(u+1),g=l[p],b=g.segment,S=g.part&&g.part.start||b&&b.start;if(b.timeline===r&&typeof S<"u"){const w=Math.abs(n-S);if(a!==null&&a<w)break;(!s||a===null||a>=w)&&(a=w,s={time:S,segmentIndex:g.segmentIndex,partIndex:g.partIndex})}}return s}},{name:"Discontinuity",run:(i,e,t,r,n)=>{let s=null;if(n=n||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let l=0;l<e.discontinuityStarts.length;l++){const u=e.discontinuityStarts[l],p=e.discontinuitySequence+l+1,g=i.discontinuities[p];if(g){const b=Math.abs(n-g.time);if(a!==null&&a<b)break;(!s||a===null||a>=b)&&(a=b,s={time:g.time,segmentIndex:u,partIndex:null})}}}return s}},{name:"Playlist",run:(i,e,t,r,n)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class Yw extends B.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Gm,r=new uh(t),n=new uh(t);this.mediaSequenceStorage_={main:t,audio:r,vtt:n},this.logger_=Nt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,r,n,s){if(t!==1/0)return qo.find(({name:l})=>l==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,r,n,s);if(!a.length)return null;for(const l of a){const{syncPoint:u,strategy:p}=l,{segmentIndex:g,time:b}=u;if(g<0)continue;const S=e.segments[g],w=b,C=w+S.duration;if(this.logger_(`Strategy: ${p}. Current time: ${n}. selected segment: ${g}. Time: [${w} -> ${C}]}`),n>=w&&n<C)return this.logger_("Found sync point with exact match: ",u),u}return this.selectSyncPoint_(a,{key:"time",value:n})}getExpiredTime(e,t){if(!e||!e.segments)return null;const r=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!r.length)return null;const n=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+On({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))}runStrategies_(e,t,r,n,s){const a=[];for(let l=0;l<qo.length;l++){const u=qo[l],p=u.run(this,e,t,r,n,s);p&&(p.strategy=u.name,a.push({strategy:u.name,syncPoint:p}))}return a}selectSyncPoint_(e,t){let r=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),s=e[0].strategy;for(let a=1;a<e.length;a++){const l=Math.abs(e[a].syncPoint[t.key]-t.value);l<n&&(n=l,r=e[a].syncPoint,s=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${s}]: [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>Kw){B.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let n=r-1;n>=0;n--){const s=e.segments[n];if(s&&typeof s.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+n,time:s.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),n=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start}));const s=n.dateTimeObject;n.discontinuity&&t&&s&&(this.timelineToDatetimeMappings[n.timeline]=-(s.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 n=e.segment,s=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 s&&(s.start=l,s.end=u),(!n.start||l<n.start)&&(n.start=l),n.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 n=0;n<t.discontinuityStarts.length;n++){const s=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,l=s-e.mediaIndex,u=Math.abs(l);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>u){let p;l<0?p=r.start-On({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:s}):p=r.end+On({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[a]={time:p,accuracy:u}}}}dispose(){this.trigger("dispose"),this.off()}}class Qw extends B.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 n={timelineChangeInfo:{from:t,to:r}};this.trigger({type:"timelinechange",metadata:n})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Jw=Dm(Pm(function(){var i=function(){function v(){this.listeners={}}var D=v.prototype;return D.on=function(L,O){this.listeners[L]||(this.listeners[L]=[]),this.listeners[L].push(O)},D.off=function(L,O){if(!this.listeners[L])return!1;var U=this.listeners[L].indexOf(O);return this.listeners[L]=this.listeners[L].slice(0),this.listeners[L].splice(U,1),U>-1},D.trigger=function(L){var O=this.listeners[L];if(O)if(arguments.length===2)for(var U=O.length,F=0;F<U;++F)O[F].call(this,arguments[1]);else for(var N=Array.prototype.slice.call(arguments,1),V=O.length,J=0;J<V;++J)O[J].apply(this,N)},D.dispose=function(){this.listeners={}},D.pipe=function(L){this.on("data",function(O){L.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=[[[],[],[],[],[]],[[],[],[],[],[]]],D=v[0],L=v[1],O=D[4],U=L[4];let F,N,V;const J=[],Y=[];let ie,he,le,pe,ee,ce;for(F=0;F<256;F++)Y[(J[F]=F<<1^(F>>7)*283)^F]=F;for(N=V=0;!O[N];N^=ie||1,V=Y[V]||1)for(pe=V^V<<1^V<<2^V<<3^V<<4,pe=pe>>8^pe&255^99,O[N]=pe,U[pe]=N,le=J[he=J[ie=J[N]]],ce=le*16843009^he*65537^ie*257^N*16843008,ee=J[pe]*257^pe*16843008,F=0;F<4;F++)D[F][N]=ee=ee<<24^ee>>>8,L[F][pe]=ce=ce<<24^ce>>>8;for(F=0;F<5;F++)D[F]=D[F].slice(0),L[F]=L[F].slice(0);return v};let r=null;class n{constructor(D){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 L,O,U;const F=this._tables[0][4],N=this._tables[1],V=D.length;let J=1;if(V!==4&&V!==6&&V!==8)throw new Error("Invalid aes key size");const Y=D.slice(0),ie=[];for(this._key=[Y,ie],L=V;L<4*V+28;L++)U=Y[L-1],(L%V===0||V===8&&L%V===4)&&(U=F[U>>>24]<<24^F[U>>16&255]<<16^F[U>>8&255]<<8^F[U&255],L%V===0&&(U=U<<8^U>>>24^J<<24,J=J<<1^(J>>7)*283)),Y[L]=Y[L-V]^U;for(O=0;L;O++,L--)U=Y[O&3?L:L-4],L<=4||O<4?ie[O]=U:ie[O]=N[0][F[U>>>24]]^N[1][F[U>>16&255]]^N[2][F[U>>8&255]]^N[3][F[U&255]]}decrypt(D,L,O,U,F,N){const V=this._key[1];let J=D^V[0],Y=U^V[1],ie=O^V[2],he=L^V[3],le,pe,ee;const ce=V.length/4-2;let ne,de=4;const we=this._tables[1],ze=we[0],dt=we[1],Ot=we[2],ht=we[3],Ut=we[4];for(ne=0;ne<ce;ne++)le=ze[J>>>24]^dt[Y>>16&255]^Ot[ie>>8&255]^ht[he&255]^V[de],pe=ze[Y>>>24]^dt[ie>>16&255]^Ot[he>>8&255]^ht[J&255]^V[de+1],ee=ze[ie>>>24]^dt[he>>16&255]^Ot[J>>8&255]^ht[Y&255]^V[de+2],he=ze[he>>>24]^dt[J>>16&255]^Ot[Y>>8&255]^ht[ie&255]^V[de+3],de+=4,J=le,Y=pe,ie=ee;for(ne=0;ne<4;ne++)F[(3&-ne)+N]=Ut[J>>>24]<<24^Ut[Y>>16&255]<<16^Ut[ie>>8&255]<<8^Ut[he&255]^V[de++],le=J,J=Y,Y=ie,ie=he,he=le}}class s 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(D){this.jobs.push(D),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,D,L){const O=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),U=new n(Array.prototype.slice.call(D)),F=new Uint8Array(v.byteLength),N=new Int32Array(F.buffer);let V,J,Y,ie,he,le,pe,ee,ce;for(V=L[0],J=L[1],Y=L[2],ie=L[3],ce=0;ce<O.length;ce+=4)he=a(O[ce]),le=a(O[ce+1]),pe=a(O[ce+2]),ee=a(O[ce+3]),U.decrypt(he,le,pe,ee,N,ce),N[ce]=a(N[ce]^V),N[ce+1]=a(N[ce+1]^J),N[ce+2]=a(N[ce+2]^Y),N[ce+3]=a(N[ce+3]^ie),V=he,J=le,Y=pe,ie=ee;return F};class u{constructor(D,L,O,U){const F=u.STEP,N=new Int32Array(D.buffer),V=new Uint8Array(D.byteLength);let J=0;for(this.asyncStream_=new s,this.asyncStream_.push(this.decryptChunk_(N.subarray(J,J+F),L,O,V)),J=F;J<N.length;J+=F)O=new Uint32Array([a(N[J-4]),a(N[J-3]),a(N[J-2]),a(N[J-1])]),this.asyncStream_.push(this.decryptChunk_(N.subarray(J,J+F),L,O,V));this.asyncStream_.push(function(){U(null,e(V))})}static get STEP(){return 32e3}decryptChunk_(D,L,O,U){return function(){const F=l(D,L,O);U.set(F,D.byteOffset)}}}var p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ys<"u"?Ys:typeof self<"u"?self:{},g;typeof window<"u"?g=window:typeof p<"u"?g=p:typeof self<"u"?g=self:g={};var b=g,S=function(v){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(v):v&&v.buffer instanceof ArrayBuffer},w=b.BigInt||Number;w("0x1"),w("0x100"),w("0x10000"),w("0x1000000"),w("0x100000000"),w("0x10000000000"),w("0x1000000000000"),w("0x100000000000000"),w("0x10000000000000000"),function(){var v=new Uint16Array([65484]),D=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);return D[0]===255?"big":D[0]===204?"little":"unknown"}();const C=function(v){const D={};return Object.keys(v).forEach(L=>{const O=v[L];S(O)?D[L]={bytes:O.buffer,byteOffset:O.byteOffset,byteLength:O.byteLength}:D[L]=O}),D};self.onmessage=function(v){const D=v.data,L=new Uint8Array(D.encrypted.bytes,D.encrypted.byteOffset,D.encrypted.byteLength),O=new Uint32Array(D.key.bytes,D.key.byteOffset,D.key.byteLength/4),U=new Uint32Array(D.iv.bytes,D.iv.byteOffset,D.iv.byteLength/4);new u(L,O,U,function(F,N){self.postMessage(C({source:D.source,decrypted:N}),[N.buffer])})}}));var Zw=Lm(Jw);const e2=i=>{let e=i.default?"main":"alternative";return i.characteristics&&i.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Xm=(i,e)=>{i.abort(),i.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},_l=(i,e)=>{e.activePlaylistLoader=i,i.load()},t2=(i,e)=>()=>{const{segmentLoaders:{[i]:t,main:r},mediaTypes:{[i]:n}}=e,s=n.activeTrack(),a=n.getActiveGroup(),l=n.activePlaylistLoader,u=n.lastGroup_;if(!(a&&u&&a.id===u.id)&&(n.lastGroup_=a,n.lastTrack_=s,Xm(t,n),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){l&&r.resetEverything();return}t.resyncLoader(),_l(a.playlistLoader,n)}},i2=(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:r}}=e;r.lastGroup_=null,t.abort(),t.pause()},r2=(i,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[i]:r,main:n},mediaTypes:{[i]:s}}=e,a=s.activeTrack(),l=s.getActiveGroup(),u=s.activePlaylistLoader,p=s.lastTrack_;if(!(p&&a&&p.id===a.id)&&(s.lastGroup_=l,s.lastTrack_=a,Xm(r,s),!!l)){if(l.isMainPlaylist){if(!a||!p||a.id===p.id)return;const g=e.vhs.playlistController_,b=g.selectPlaylist();if(g.media()===b)return;s.logger_(`track change. Switching main audio from ${p.id} to ${a.id}`),t.pause(),n.resetEverything(),g.fastQualityChange_(b);return}if(i==="AUDIO"){if(!l.playlistLoader){n.setAudio(!0),n.resetEverything();return}r.setAudio(!0),n.setAudio(!1)}if(u===l.playlistLoader){_l(l.playlistLoader,s);return}r.track&&r.track(a),r.resetEverything(),_l(l.playlistLoader,s)}},_a={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:t},excludePlaylist:r}=e,n=t.activeTrack(),s=t.activeGroup(),a=(s.filter(u=>u.default)[0]||s[0]).id,l=t.tracks[a];if(n===l){r({error:{message:"Problem encountered loading the default audio track."}});return}B.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const u in t.tracks)t.tracks[u].enabled=t.tracks[u]===l;t.onTrackChanged()},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:t}}=e;B.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=t.activeTrack();r&&(r.mode="disabled"),t.onTrackChanged()}},ch={AUDIO:(i,e,t)=>{if(!e)return;const{tech:r,requestOptions:n,segmentLoaders:{[i]:s}}=t;e.on("loadedmetadata",()=>{const a=e.media();s.playlist(a,n),(!r.paused()||a.endList&&r.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),n),r.paused()||s.load()}),e.on("error",_a[i](i,t))},SUBTITLES:(i,e,t)=>{const{tech:r,requestOptions:n,segmentLoaders:{[i]:s},mediaTypes:{[i]:a}}=t;e.on("loadedmetadata",()=>{const l=e.media();s.playlist(l,n),s.track(a.activeTrack()),(!r.paused()||l.endList&&r.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),n),r.paused()||s.load()}),e.on("error",_a[i](i,t))}},n2={AUDIO:(i,e)=>{const{vhs:t,sourceType:r,segmentLoaders:{[i]:n},requestOptions:s,main:{mediaGroups:a},mediaTypes:{[i]:{groups:l,tracks:u,logger_:p}},mainPlaylistLoader:g}=e,b=ts(g.main);(!a[i]||Object.keys(a[i]).length===0)&&(a[i]={main:{default:{default:!0}}},b&&(a[i].main.default.playlists=g.main.playlists));for(const S in a[i]){l[S]||(l[S]=[]);for(const w in a[i][S]){let C=a[i][S][w],v;if(b?(p(`AUDIO group '${S}' label '${w}' is a main playlist`),C.isMainPlaylist=!0,v=null):r==="vhs-json"&&C.playlists?v=new Er(C.playlists[0],t,s):C.resolvedUri?v=new Er(C.resolvedUri,t,s):C.playlists&&r==="dash"?v=new pl(C.playlists[0],t,s,g):v=null,C=fe({id:w,playlistLoader:v},C),ch[i](i,C.playlistLoader,e),l[S].push(C),typeof u[w]>"u"){const D=new B.AudioTrack({id:w,kind:e2(C),enabled:!1,language:C.language,default:C.default,label:w});u[w]=D}}}n.on("error",_a[i](i,e))},SUBTITLES:(i,e)=>{const{tech:t,vhs:r,sourceType:n,segmentLoaders:{[i]:s},requestOptions:a,main:{mediaGroups:l},mediaTypes:{[i]:{groups:u,tracks:p}},mainPlaylistLoader:g}=e;for(const b in l[i]){u[b]||(u[b]=[]);for(const S in l[i][b]){if(!r.options_.useForcedSubtitles&&l[i][b][S].forced)continue;let w=l[i][b][S],C;if(n==="hls")C=new Er(w.resolvedUri,r,a);else if(n==="dash"){if(!w.playlists.filter(v=>v.excludeUntil!==1/0).length)return;C=new pl(w.playlists[0],r,a,g)}else n==="vhs-json"&&(C=new Er(w.playlists?w.playlists[0]:w.resolvedUri,r,a));if(w=fe({id:S,playlistLoader:C},w),ch[i](i,w.playlistLoader,e),u[b].push(w),typeof p[S]>"u"){const v=t.addRemoteTextTrack({id:S,kind:"subtitles",default:w.default&&w.autoselect,language:w.language,label:S},!1).track;p[S]=v}}}s.on("error",_a[i](i,e))},"CLOSED-CAPTIONS":(i,e)=>{const{tech:t,main:{mediaGroups:r},mediaTypes:{[i]:{groups:n,tracks:s}}}=e;for(const a in r[i]){n[a]||(n[a]=[]);for(const l in r[i][a]){const u=r[i][a][l];if(!/^(?:CC|SERVICE)/.test(u.instreamId))continue;const p=t.options_.vhs&&t.options_.vhs.captionServices||{};let g={label:l,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(p[g.instreamId]&&(g=fe(g,p[g.instreamId])),g.default===void 0&&delete g.default,n[a].push(fe({id:l},u)),typeof s[l]>"u"){const b=t.addRemoteTextTrack({id:g.instreamId,kind:"captions",default:g.default,language:g.language,label:g.label},!1).track;s[l]=b}}}}},Km=(i,e)=>{for(let t=0;t<i.length;t++)if(Eu(e,i[t])||i[t].playlists&&Km(i[t].playlists,e))return!0;return!1},s2=(i,e)=>t=>{const{mainPlaylistLoader:r,mediaTypes:{[i]:{groups:n}}}=e,s=r.media();if(!s)return null;let a=null;s.attributes[i]&&(a=n[s.attributes[i]]);const l=Object.keys(n);if(!a)if(i==="AUDIO"&&l.length>1&&ts(e.main))for(let u=0;u<l.length;u++){const p=n[l[u]];if(Km(p,s)){a=p;break}}else n.main?a=n.main:l.length===1&&(a=n[l[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(u=>u.id===t.id)[0]||null},a2={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}},o2=(i,{mediaTypes:e})=>()=>{const t=e[i].activeTrack();return t?e[i].activeGroup(t):null},l2=i=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(p=>{n2[p](p,i)});const{mediaTypes:e,mainPlaylistLoader:t,tech:r,vhs:n,segmentLoaders:{["AUDIO"]:s,main:a}}=i;["AUDIO","SUBTITLES"].forEach(p=>{e[p].activeGroup=s2(p,i),e[p].activeTrack=a2[p](p,i),e[p].onGroupChanged=t2(p,i),e[p].onGroupChanging=i2(p,i),e[p].onTrackChanged=r2(p,i),e[p].getActiveGroup=o2(p,i)});const l=e.AUDIO.activeGroup();if(l){const p=(l.filter(g=>g.default)[0]||l[0]).id;e.AUDIO.tracks[p].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),s.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(p=>e[p].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(p=>e[p].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),n.on("dispose",()=>{r.audioTracks().removeEventListener("change",u),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const p in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[p])},u2=()=>{const i={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:pi,activeTrack:pi,getActiveGroup:pi,onGroupChanged:pi,onTrackChanged:pi,lastTrack_:null,logger_:Nt(`MediaGroups[${e}]`)}}),i};class dh{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=yt(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class c2 extends B.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new dh,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Nt("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const 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=yt(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 n={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:n}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(s,a)=>{if(s){if(a.status===410){this.logger_(`manifest request 410 ${s}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(a.status===429){const p=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${s}.`),this.logger_(`content steering will retry in ${p} seconds.`),this.startTTLTimeout_(parseInt(p,10));return}this.logger_(`manifest failed to load ${s}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:n});let l;try{l=JSON.parse(this.request_.responseText)}catch(p){const g={errorType:B.Error.StreamingContentSteeringParserError,error:p};this.trigger({type:"error",metadata:g})}this.assignSteeringProperties_(l);const u={contentSteeringInfo:n.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 x.URL(e),r=new x.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const t=JSON.parse(x.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new x.URL(e),r=this.getPathway(),n=this.getBandwidth_();if(r){const s=`_${this.manifestType_}_pathway`;t.searchParams.set(s,r)}if(n){const s=`_${this.manifestType_}_throughput`;t.searchParams.set(s,n)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const t=(r=>{for(const n of r)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=n=>this.excludedSteeringManifestURLs.has(n);if(this.proxyServerUrl_){const n=this.setProxyServerUrl_(e);if(!t(n))return n}const r=this.setSteeringParams_(e);return t(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=x.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){x.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 dh}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(yt(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const d2=(i,e)=>{let t=null;return(...r)=>{clearTimeout(t),t=setTimeout(()=>{i.apply(null,r)},e)}},h2=10;let Pi;const p2=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],g2=function(i){return this.audioSegmentLoader_[i]+this.mainSegmentLoader_[i]},m2=function({currentPlaylist:i,buffered:e,currentTime:t,nextPlaylist:r,bufferLowWaterLine:n,bufferHighWaterLine:s,duration:a,bufferBasedABR:l,log:u}){if(!r)return B.log.warn("We received no playlist to switch to. Please check your stream."),!1;const p=`allowing switch ${i&&i.id||"null"} -> ${r.id}`;if(!i)return u(`${p} as current playlist is not set`),!0;if(r.id===i.id)return!1;const g=!!Sr(e,t).length;if(!i.endList)return!g&&typeof i.partTargetDuration=="number"?(u(`not ${p} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(u(`${p} as current playlist is live`),!0);const b=vu(e,t),S=l?Xe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Xe.MAX_BUFFER_LOW_WATER_LINE;if(a<S)return u(`${p} as duration < max low water line (${a} < ${S})`),!0;const w=r.attributes.BANDWIDTH,C=i.attributes.BANDWIDTH;if(w<C&&(!l||b<s)){let v=`${p} as next bandwidth < current bandwidth (${w} < ${C})`;return l&&(v+=` and forwardBuffer < bufferHighWaterLine (${b} < ${s})`),u(v),!0}if((!l||w>C)&&b>=n){let v=`${p} as forwardBuffer >= bufferLowWaterLine (${b} >= ${n})`;return l&&(v+=` and next bandwidth > current bandwidth (${w} > ${C})`),u(v),!0}return u(`not ${p} as no switching criteria met`),!1};class f2 extends B.EventTarget{constructor(e){super(),this.fastQualityChange_=d2(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:r,tech:n,bandwidth:s,externVhs:a,useCueTags:l,playlistExclusionDuration:u,enableLowInitialPlaylist:p,sourceType:g,cacheEncryptionKeys:b,bufferBasedABR:S,leastPixelDiffSelector:w,captionServices:C,experimentalUseMMS:v}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:D}=e;(D===null||typeof D>"u")&&(D=1/0),Pi=a,this.bufferBasedABR=!!S,this.leastPixelDiffSelector=!!w,this.withCredentials=r,this.tech_=n,this.vhs_=n.vhs,this.player_=e.player_,this.sourceType_=g,this.useCueTags_=l,this.playlistExclusionDuration=u,this.maxPlaylistRetries=D,this.enableLowInitialPlaylist=p,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:D,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=u2(),v&&x.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new x.ManagedMediaSource,this.usingManagedMediaSource_=!0,B.log("Using ManagedMediaSource")):x.MediaSource&&(this.mediaSource=new x.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=it(),this.hasPlayed_=!1,this.syncController_=new Yw(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Zw,this.sourceUpdater_=new Wm(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Qw,this.keyStatusMap_=new Map;const L={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:C,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:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:b,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new pl(t,this.vhs_,fe(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Er(t,this.vhs_,fe(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new fl(fe(L,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new fl(fe(L,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new zw(fe(L,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((F,N)=>{function V(){n.off("vttjserror",J),F()}function J(){n.off("vttjsloaded",V),N()}n.one("vttjsloaded",V),n.one("vttjserror",J),n.addWebVttScript_()})}),e);const O=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new c2(this.vhs_.xhr,O),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),p2.forEach(F=>{this[F+"_"]=g2.bind(this,F)}),this.logger_=Nt("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const U=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(U,()=>{const F=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-F,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,r){const n=this.media(),s=n&&(n.id||n.uri),a=e&&(e.id||e.uri);if(s&&s!==a){this.logger_(`switch media ${s} -> ${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,n=this.contentSteeringController_.getPathway();if(r&&n){const s=(r.length?r[0].playlists:r.playlists).filter(a=>a.attributes.serviceLocation===n);s.length&&this.mediaTypes_[e].activePlaylistLoader.media(s[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=x.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(x.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,n=Object.keys(r);let s;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)s=this.mediaTypes_.AUDIO.activeTrack();else{const l=r.main||n.length&&r[n[0]];for(const u in l)if(l[u].default){s={label:u};break}}if(!s)return t;const a=[];for(const l in r)if(r[l][s.label]){const u=r[l][s.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 p=0;p<e.playlists.length;p++){const g=e.playlists[p];g.attributes&&g.attributes.AUDIO&&g.attributes.AUDIO===l&&a.push(g)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ll(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),l2({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let t;if(this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ll(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();e.lastExcludeReason_!=="playlist-unchanged"&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(e=>{this.mainPlaylistLoader_.on(e,t=>{this.player_.trigger(Ve({},t))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const r=e.mediaGroups||{};let n=!0;const s=Object.keys(r.AUDIO);for(const a in r.AUDIO)for(const l in r.AUDIO[a])r.AUDIO[a][l].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Pi.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(r.AUDIO[s[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(),n=this.bufferLowWaterLine(),s=this.bufferHighWaterLine(),a=this.tech_.buffered();return m2({buffered:a,currentTime:r,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:s,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const t=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const t=this.audioSegmentLoader_.pendingSegment_;if(!t||!t.segment||!t.segment.syncInfo)return;const r=t.segment.syncInfo.end+.01;this.tech_.setCurrentTime(r)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",t=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:h2}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const t=this.getCodecsOrExclude_();t&&this.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(t=>{this.mainSegmentLoader_.on(t,r=>{this.player_.trigger(Ve({},r))}),this.audioSegmentLoader_.on(t,r=>{this.player_.trigger(Ve({},r))}),this.subtitleSegmentLoader_.on(t,r=>{this.player_.trigger(Ve({},r))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const r=t.end(0);let n=r;if(e.start){const s=e.start.timeOffset;s<0?n=Math.max(r+s,t.start(0)):n=Math.min(r,s)}this.trigger("firstplay"),this.tech_.setCurrentTime(n)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const t=this.syncController_.getExpiredTime(e,this.duration());if(t===null)return!1;const r=Pi.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return r-n<=ei;const a=s.end(s.length-1);return a-n<=ei&&r-a<=ei}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 n=this.mainPlaylistLoader_.main.playlists,s=n.filter(Ga),a=s.length===1&&s[0]===e;if(n.length===1&&r!==1/0)return B.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const C=this.pathwayAttribute_(e),v=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(C),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(C)},v);return}let w=!1;n.forEach(C=>{if(C===e)return;const v=C.excludeUntil;typeof v<"u"&&v!==1/0&&(w=!0,delete C.excludeUntil)}),w&&(B.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+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 p=t.internal?this.logger_:B.log.warn,g=t.message?" "+t.message:"";p(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${g} 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 b=u.targetDuration/2*1e3||5*1e3,S=typeof u.lastRequest=="number"&&Date.now()-u.lastRequest<=b;return this.switchMedia_(u,"exclude",a||S)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const r=[],n=e==="all";(n||e==="main")&&r.push(this.mainPlaylistLoader_);const s=[];(n||e==="audio")&&s.push("AUDIO"),(n||e==="subtitle")&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.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=Sr(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:Pi.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const r=e.media();if(!r)return null;const n=this.syncController_.getMediaSequenceSync(t);if(n&&n.isReliable){const l=n.start,u=n.end;if(!isFinite(l)||!isFinite(u))return null;const p=Pi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r),g=Math.max(0,u-p);return g<l?null:it([[l,g]])}const s=this.syncController_.getExpiredTime(r,this.duration());if(s===null)return null;const a=Pi.Playlist.seekable(r,s,Pi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const r=e.start(0),n=e.end(0),s=t.start(0),a=t.end(0);return s>n||r>a?e:it([[Math.max(r,s),Math.min(n,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const 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 [${am(this.seekable_)}]`);const n={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:n}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const n=this.seekable();if(!n.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<n.end(n.length-1))&&this.sourceUpdater_.setDuration(n.end(n.length-1));return}const t=this.tech_.buffered();let r=Pi.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(n=>{n.playlistLoader&&n.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),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=Un(this.main(),t),n={},s=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=r.video||e.main.videoCodec||aT),e.main.isMuxed&&(n.video+=`,${r.audio||e.main.audioCodec||ad}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||s)&&(n.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||ad,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(p,g)=>p?Dn(g,this.usingManagedMediaSource_):ko(g),l={};let u;if(["video","audio"].forEach(function(p){if(n.hasOwnProperty(p)&&!a(e[p].isFmp4,n[p])){const g=e[p].isFmp4?"browser":"muxer";l[g]=l[g]||[],l[g].push(n[p]),p==="audio"&&(u=g)}}),s&&u&&t.attributes.AUDIO){const p=t.attributes.AUDIO;this.main().playlists.forEach(g=>{(g.attributes&&g.attributes.AUDIO)===p&&g!==t&&(g.excludeUntil=1/0)}),this.logger_(`excluding audio group ${p} as ${u} does not support codec(s): "${n.audio}"`)}if(Object.keys(l).length){const p=Object.keys(l).reduce((g,b)=>(g&&(g+=", "),g+=`${b} does not support codec(s): "${l[b].join(",")}"`,g),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:p},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const p=[];if(["video","audio"].forEach(g=>{const b=(Kt(this.sourceUpdater_.codecs[g]||"")[0]||{}).type,S=(Kt(n[g]||"")[0]||{}).type;b&&S&&b.toLowerCase()!==S.toLowerCase()&&p.push(`"${this.sourceUpdater_.codecs[g]}" -> "${n[g]}"`)}),p.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${p.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return n}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(r=>{const n=e[r];if(t.indexOf(n.id)!==-1)return;t.push(n.id);const s=Un(this.main,n),a=[];s.audio&&!ko(s.audio)&&!Dn(s.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${s.audio}`),s.video&&!ko(s.video)&&!Dn(s.video,this.usingManagedMediaSource_)&&a.push(`video codec ${s.video}`),s.text&&s.text==="stpp.ttml.im1t"&&a.push(`text codec ${s.text}`),a.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],r=this.main().playlists,n=fa(Kt(e)),s=Jd(n),a=n.video&&Kt(n.video)[0]||null,l=n.audio&&Kt(n.audio)[0]||null;Object.keys(r).forEach(u=>{const p=r[u];if(t.indexOf(p.id)!==-1||p.excludeUntil===1/0)return;t.push(p.id);const g=[],b=Un(this.mainPlaylistLoader_.main,p),S=Jd(b);if(!(!b.audio&&!b.video)){if(S!==s&&g.push(`codec count "${S}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){const w=b.video&&Kt(b.video)[0]||null,C=b.audio&&Kt(b.audio)[0]||null;w&&a&&w.type.toLowerCase()!==a.type.toLowerCase()&&g.push(`video codec "${w.type}" !== "${a.type}"`),C&&l&&C.type.toLowerCase()!==l.type.toLowerCase()&&g.push(`audio codec "${C.type}" !== "${l.type}"`)}g.length&&(p.excludeUntil=1/0,this.logger_(`excluding ${p.id}: ${g.join(" && ")}`))}})}updateAdCues_(e){let t=0;const r=this.seekable();r.length&&(t=r.start(0)),Gw(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Xe.GOAL_BUFFER_LENGTH,r=Xe.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Xe.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*r,n)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Xe.BUFFER_LOW_WATER_LINE,r=Xe.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Xe.MAX_BUFFER_LOW_WATER_LINE),s=Math.max(t,Xe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*r,this.bufferBasedABR?s:n)}bufferHighWaterLine(){return Xe.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){th(this.inbandTextTracks_,"com.apple.streaming",this.tech_),Cw({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,r){const n=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();th(this.inbandTextTracks_,e,this.tech_),Ew({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,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(e=>{this.contentSteeringController_.on(e,t=>{this.trigger(Ve({},t))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const t=this.contentSteeringController_.getAvailablePathways(),r=[];for(const n of e.playlists){const s=n.attributes.serviceLocation;if(s&&(r.push(s),!t.has(s)))return!0}return!!(!r.length&&t.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const t=this.main().playlists,r=new Set;let n=!1;Object.keys(t).forEach(s=>{const a=t[s],l=this.pathwayAttribute_(a),u=l&&e!==l;a.excludeUntil===1/0&&a.lastExcludeReason_==="content-steering"&&!u&&(delete a.excludeUntil,delete a.lastExcludeReason_,n=!0);const p=!a.excludeUntil&&a.excludeUntil!==1/0;!r.has(a.id)&&u&&p&&(r.add(a.id),a.excludeUntil=1/0,a.lastExcludeReason_="content-steering",this.logger_(`excluding ${a.id} for ${a.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(s=>{const a=this.mediaTypes_[s];if(a.activePlaylistLoader){const l=a.activePlaylistLoader.media_;l&&l.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,r=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||r&&r.size){for(const[n,s]of t.entries())r.get(n)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(n));for(const[n,s]of r.entries()){const a=t.get(n);if(!a){e.filter(l=>l.attributes["PATHWAY-ID"]===s["BASE-ID"]).forEach(l=>{this.mainPlaylistLoader_.addClonePathway(s,l)}),this.contentSteeringController_.addAvailablePathway(n);continue}this.equalPathwayClones_(a,s)||(this.mainPlaylistLoader_.updateOrDeleteClone(s,!0),this.contentSteeringController_.addAvailablePathway(n))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...r])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(const s in r)if(r[s]!==n[s])return!1;for(const s in n)if(r[s]!==n[s])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 n=this.mainPlaylistLoader_.getKeyIdSet(r);!n||!n.size||n.forEach(s=>{const a="usable",l=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)===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 ${s} 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 ${s} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const n=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,s=r.excludeUntil===1/0&&r.lastExcludeReason_===t;n&&s&&(delete r.excludeUntil,B.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const r=(typeof e=="string"?e:Vw(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${r} added to the keyStatusMap`),this.keyStatusMap_.set(r,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const y2=(i,e,t)=>r=>{const n=i.main.playlists[e],s=Su(n),a=Ga(n);if(typeof r>"u")return a;r?delete n.disabled:n.disabled=!0;const l={renditionInfo:{id:e,bandwidth:n.attributes.BANDWIDTH,resolution:n.attributes.RESOLUTION,codecs:n.attributes.CODECS},cause:"fast-quality"};return r!==a&&!s&&(r?(t(n),i.trigger({type:"renditionenabled",metadata:l})):i.trigger({type:"renditiondisabled",metadata:l})),r};class _2{constructor(e,t,r){const{playlistController_:n}=e,s=n.fastQualityChange_.bind(n);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=Un(n.main(),t),this.playlist=t,this.id=r,this.enabled=y2(e.playlists,t.id,s)}}const b2=function(i){i.representations=()=>{const e=i.playlistController_.main(),t=ts(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(r=>!Su(r)).map((r,n)=>new _2(i,r,r.id)):[]}},hh=["seeking","seeked","pause","playing","error"];class v2 extends B.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Nt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),a=this.playlistController_,l=["main","subtitle","audio"],u={};l.forEach(g=>{u[g]={reset:()=>this.resetSegmentDownloads_(g),updateend:()=>this.checkSegmentDownloads_(g)},a[`${g}SegmentLoader_`].on("appendsdone",u[g].updateend),a[`${g}SegmentLoader_`].on("playlistupdate",u[g].reset),this.tech_.on(["seeked","seeking"],u[g].reset)});const p=g=>{["main","audio"].forEach(b=>{a[`${b}SegmentLoader_`][g]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),p("off"))},this.clearSeekingAppendCheck_=()=>p("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),p("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(hh,s),this.tech_.on("canplay",r),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(hh,s),this.tech_.off("canplay",r),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(g=>{a[`${g}SegmentLoader_`].off("appendsdone",u[g].updateend),a[`${g}SegmentLoader_`].off("playlistupdate",u[g].reset),this.tech_.off(["seeked","seeking"],u[g].reset)}),this.checkCurrentTimeTimeout_&&x.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&x.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=x.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_`],n=r.buffered_(),s=nE(this[`${e}Buffered_`],n);if(this[`${e}Buffered_`]=n,s){const a={bufferedRanges:n};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:Qi(n)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+ei>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(it([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 e=this.seekable(),t=this.tech_.currentTime(),r=this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(r&&(n=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)){const w=e.start(0);n=w+(w===e.end(0)?0:ei)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${am(e)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const s=this.playlistController_.sourceUpdater_,a=this.tech_.buffered(),l=s.audioBuffer?s.audioBuffered():null,u=s.videoBuffer?s.videoBuffered():null,p=this.media(),g=p.partTargetDuration?p.partTargetDuration:(p.targetDuration-Zt)*2,b=[l,u];for(let w=0;w<b.length;w++)if(b[w]&&vu(b[w],t)<g)return!1;const S=Ms(a,t);return S.length===0?!1:(n=S.start(0)+ei,this.logger_(`Buffered region starts (${S.start(0)}) just beyond seek point (${t}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),r=Sr(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 a=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${a}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(a),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,n=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 s=Ms(n,t);return s.length>0?(this.logger_(`Stopped at ${t} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,r,n=!1){if(!e.length)return!1;let s=e.end(e.length-1)+ei;const a=!r.endList,l=typeof r.partTargetDuration=="number";return a&&(l||n)&&(s=e.end(e.length-1)+r.targetDuration*3),t>s}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 n;if(e.length&&t.length){const s=Sr(e,r-3),a=Sr(e,r),l=Sr(t,r);l.length&&!a.length&&s.length&&(n={start:s.end(0),end:l.end(0)})}else Ms(e,r).length||(n=this.gapFromVideoUnderflow_(e,r));return n?(this.logger_(`Encountered a gap in video from ${n.start} to ${n.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),r=this.tech_.currentTime(),n=Ms(t,r);if(this.resetTimeUpdate_(),n.length===0||r!==e)return;this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+Zt);const s={gapInfo:{from:r,to:n.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:s}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const r=tE(e);for(let n=0;n<r.length;n++){const s=r.start(n),a=r.end(n);if(t-s<4&&t-s>2)return{start:s,end:a}}return null}}const T2={errorInterval:30,getSource(i){const e=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return i(e)}},Ym=function(i,e){let t=0,r=0;const n=fe(T2,e);i.ready(()=>{i.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const s=function(){r&&i.currentTime(r)},a=function(g){g!=null&&(r=i.duration()!==1/0&&i.currentTime()||0,i.one("loadedmetadata",s),i.src(g),i.trigger({type:"usage",name:"vhs-error-reload"}),i.play())},l=function(){if(Date.now()-t<n.errorInterval*1e3){i.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!n.getSource||typeof n.getSource!="function"){B.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),n.getSource.call(i,a)},u=function(){i.off("loadedmetadata",s),i.off("error",l),i.off("dispose",u)},p=function(g){u(),Ym(i,g)};i.on("error",l),i.on("dispose",u),i.reloadSourceOnError=p},S2=function(i){Ym(this,i)};var Qm="3.16.2",E2="7.1.0",w2="1.3.1",k2="7.2.0",C2="4.0.2";const Ne={PlaylistLoader:Er,Playlist:_t,utils:AE,STANDARD_PLAYLIST_SELECTOR:eh,INITIAL_PLAYLIST_SELECTOR:_w,lastBandwidthSelector:eh,movingAverageBandwidthSelector:fw,comparePlaylistBandwidth:ku,comparePlaylistResolution:mw,xhr:Em()};Object.keys(Xe).forEach(i=>{Object.defineProperty(Ne,i,{get(){return B.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),Xe[i]},set(e){if(B.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){B.log.warn(`value of Vhs.${i} must be greater than or equal to 0`);return}Xe[i]=e}})});const Jm="videojs-vhs",Zm=function(i,e){const t=e.media();let r=-1;for(let n=0;n<i.length;n++)if(i[n].id===t.id){r=n;break}i.selectedIndex_=r,i.trigger({selectedIndex:r,type:"change"})},I2=function(i,e){e.representations().forEach(t=>{i.addQualityLevel(t)}),Zm(i,e.playlists)};Ne.canPlaySource=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const A2=(i,e,t)=>{if(!i)return i;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=fa(Kt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(r.audio=t.attributes.CODECS);const n=Or(r.video),s=Or(r.audio),a={};for(const l in i)a[l]={},s&&(a[l].audioContentType=s),n&&(a[l].videoContentType=n),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 fe(i,a)},x2=(i,e)=>i.reduce((t,r)=>{if(!r.contentProtection)return t;const n=e.reduce((s,a)=>{const l=r.contentProtection[a];return l&&l.pssh&&(s[a]={pssh:l.pssh}),s},{});return Object.keys(n).length&&t.push(n),t},[]),L2=({player:i,sourceKeySystems:e,audioMedia:t,mainPlaylists:r})=>{if(!i.eme.initializeMediaKeys)return Promise.resolve();const n=t?r.concat([t]):r,s=x2(n,Object.keys(e)),a=[],l=[];return s.forEach(u=>{l.push(new Promise((p,g)=>{i.tech_.one("keysessioncreated",p)})),a.push(new Promise((p,g)=>{i.eme.initializeMediaKeys({keySystems:u},b=>{if(b){g(b);return}p()})}))}),Promise.race([Promise.all(a),Promise.race(l)])},D2=({player:i,sourceKeySystems:e,media:t,audioMedia:r})=>{const n=A2(e,t,r);return n?(i.currentSource().keySystems=n,n&&!i.eme?(B.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},ef=()=>{if(!x.localStorage)return null;const i=x.localStorage.getItem(Jm);if(!i)return null;try{return JSON.parse(i)}catch{return null}},P2=i=>{if(!x.localStorage)return!1;let e=ef();e=e?fe(e,i):i;try{x.localStorage.setItem(Jm,JSON.stringify(e))}catch{return!1}return e},R2=i=>i.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(i.substring(i.indexOf(",")+1)):i,tf=(i,e)=>{i._requestCallbackSet||(i._requestCallbackSet=new Set),i._requestCallbackSet.add(e)},rf=(i,e)=>{i._responseCallbackSet||(i._responseCallbackSet=new Set),i._responseCallbackSet.add(e)},nf=(i,e)=>{i._requestCallbackSet&&(i._requestCallbackSet.delete(e),i._requestCallbackSet.size||delete i._requestCallbackSet)},sf=(i,e)=>{i._responseCallbackSet&&(i._responseCallbackSet.delete(e),i._responseCallbackSet.size||delete i._responseCallbackSet)};Ne.supportsNativeHls=function(){if(!G||!G.createElement)return!1;const i=G.createElement("video");return B.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(i.canPlayType(e))}):!1}();Ne.supportsNativeDash=function(){return!G||!G.createElement||!B.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(G.createElement("video").canPlayType("application/dash+xml"))}();Ne.supportsTypeNatively=i=>i==="hls"?Ne.supportsNativeHls:i==="dash"?Ne.supportsNativeDash:!1;Ne.isSupported=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Ne.xhr.onRequest=function(i){tf(Ne.xhr,i)};Ne.xhr.onResponse=function(i){rf(Ne.xhr,i)};Ne.xhr.offRequest=function(i){nf(Ne.xhr,i)};Ne.xhr.offResponse=function(i){sf(Ne.xhr,i)};const N2=B.getComponent("Component");class af extends N2{constructor(e,t,r){if(super(t,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=Nt("VhsHandler"),t.options_&&t.options_.playerId){const n=B.getPlayer(t.options_.playerId);this.player_=n}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(G,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],n=>{const s=G.fullscreenElement||G.webkitFullscreenElement||G.mozFullScreenElement||G.msFullscreenElement;s&&s.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_=fe(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=ef();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=Xe.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Xe.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=R2(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Ne,this.options_.sourceType=kp(t),this.options_.seekTo=s=>{this.tech_.setCurrentTime(s)},this.options_.player_=this.player_,this.playlistController_=new f2(this.options_);const r=fe({liveRangeSafeTimeDelta:ei},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new v2(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const s=B.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),s.error(a)});const n=this.options_.bufferBasedABR?Ne.movingAverageBandwidthSelector(.55):Ne.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=Ne.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(s){this.playlistController_.selectPlaylist=s.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(s){this.playlistController_.mainSegmentLoader_.throughput.rate=s,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let s=this.playlistController_.mainSegmentLoader_.bandwidth;const a=x.navigator.connection||x.navigator.mozConnection||x.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&a){const u=a.downlink*1e3*1e3;u>=l&&s>=l?s=Math.max(s,u):s=u}return s},set(s){this.playlistController_.mainSegmentLoader_.bandwidth=s,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const s=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(s+a))},set(){B.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>Qi(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>Qi(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&P2({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{b2(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_=x.URL.createObjectURL(this.playlistController_.mediaSource),(B.browser.IS_ANY_SAFARI||B.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),L2({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=D2({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=B.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{I2(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Zm(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Qm,"mux.js":E2,"mpd-parser":w2,"m3u8-parser":k2,"aes-decrypter":C2}}version(){return this.constructor.version()}canChangeType(){return Wm.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_&&x.URL.revokeObjectURL&&(x.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return OE({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,r=!0,n=2){return Am({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{tf(this.xhr,e)},this.xhr.onResponse=e=>{rf(this.xhr,e)},this.xhr.offRequest=e=>{nf(this.xhr,e)},this.xhr.offResponse=e=>{sf(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,n=>{this.player_.trigger(Ve({},n))})}),t.forEach(r=>{this.playbackWatcher_.on(r,n=>{this.player_.trigger(Ve({},n))})})}}const ba={name:"videojs-http-streaming",VERSION:Qm,canHandleSource(i,e={}){const t=fe(B.options,e);return!t.vhs.experimentalUseMMS&&!Dn("avc1.4d400d,mp4a.40.2",!1)?!1:ba.canPlayType(i.type,t)},handleSource(i,e,t={}){const r=fe(B.options,t);return e.vhs=new af(i,e,r),e.vhs.xhr=Em(),e.vhs.setupXhrHooks_(),e.vhs.src(i.src,i.type),e.vhs},canPlayType(i,e){const t=kp(i);if(!t)return"";const r=ba.getOverrideNative(e);return!Ne.supportsTypeNatively(t)||r?"maybe":""},getOverrideNative(i={}){const{vhs:e={}}=i,t=!(B.browser.IS_ANY_SAFARI||B.browser.IS_IOS),{overrideNative:r=t}=e;return r}},O2=()=>Dn("avc1.4d400d,mp4a.40.2",!0);O2()&&B.getTech("Html5").registerSourceHandler(ba,0);B.VhsHandler=af;B.VhsSourceHandler=ba;B.Vhs=Ne;B.use||B.registerComponent("Vhs",Ne);B.options.vhs=B.options.vhs||{};(!B.getPlugin||!B.getPlugin("reloadSourceOnError"))&&B.registerPlugin("reloadSourceOnError",S2);const U2=i=>{const e=Me.useRef();return Me.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=B(t,{controls:!1,playsinline:!0})}return()=>{e.current&&(e.current.dispose(),e.current=void 0)}},[]),e},of={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},De=X.i(of),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)},M2=(i,e)=>{const t=db(i,e),r=U2(i),n=Me.useRef(),s=Me.useCallback(()=>{var p,g;const{adPosition:b,adCount:S}=De.get();if(r.current){if(b<S){const w=b+1,{ads:C,muted:v,autoplay:D}=t.get(),L=C[w-1];if(L){(p=n.current)==null||p.complete(),n.current=new ib(null,L.ad,L.creative),n.current.on("clickthrough",O=>{window.open(O,"_blank")}),De.setKey("adPosition",w),De.setKey("playMuted",v),De.setKey("skipDelay",L.creative.skipDelay||0),De.setKey("time",0),De.setKey("adAction",O=>{n.current&&n.current.click(null,{CLICKPOS:[O.clientX,O.clientY]})}),De.setKey("whyThisAd",L.creative.icons.find(O=>O.program==="GoogleWhyThisAd")||null),De.setKey("hasAdUrl",!!((g=L.creative.videoClickThroughURLTemplate)!=null&&g.url)),r.current.src(L.mediaFileUrl),De.setKey("playing",!0),b===0?(De.setKey("muted",v),De.setKey("autoplay",D),v&&r.current.muted(!0),D?r.current.play():(r.current.pause(),De.setKey("paused",!0))):r.current.play();return}}De.set(of),r.current.pause(),r.current.src(void 0)}},[r,t]),a=Me.useCallback(()=>{if(!r.current)return;const p=r.current.muted();r.current.muted(!p),De.setKey("muted",!p),n.current&&n.current.setMuted(!p)},[r]),l=Me.useCallback(()=>{r.current&&(r.current.paused()?(r.current.play(),n.current&&n.current.setPaused(!1)):(r.current.pause(),n.current&&n.current.setPaused(!0)))},[r]),u=Me.useCallback(()=>{r.current&&(n.current&&n.current.skip(),s())},[s,r]);return Me.useEffect(()=>{r.current&&(r.current.on("play",p=>{De.setKey("playing",!0),De.setKey("paused",!1),De.setKey("time",ph(p.target.player))}),r.current.on("ended",()=>{s()}),r.current.on("muted",p=>{console.log("muted",p),De.setKey("muted",p.target.player.muted())}),r.current.on("pause",()=>{De.setKey("paused",!0)}),r.current.on("click",function(p){p.target.tagName==="VIDEO"&&(De.get().autoplay||l())}),r.current.on("timeupdate",p=>{De.setKey("time",ph(p.target.player)),n.current&&n.current.setProgress(p.target.player.currentTime())}))},[l,s,r]),Me.useEffect(()=>t.subscribe(p=>{p&&(De.setKey("adCount",p.ads.length),De.setKey("adPosition",0),s())}),[t,r,s]),[De,a,l,u]},B2=({promotion:i,onClose:e,promotionId:t,externalAd:r,skipAutoClose:n})=>{var s,a,l,u,p;const g=Me.useRef(null),[b,S,w,C]=M2(g,r==null?void 0:r.url),{time:v,adCount:D,adPosition:L,skipDelay:O,playing:U,paused:F,reset:N,muted:V,playMuted:J,autoplay:Y,whyThisAd:ie,hasAdUrl:he,adAction:le}=X.useStore(b),pe=((s=i.sponsor)==null?void 0:s.logo)&&i.logoMode===ge.PromotionLogoMode.CENTER;return W.jsxs(yh,{className:"PromoOverlay",children:[W.jsxs(_h,{children:[W.jsx(bh,{className:X.cx_default(!pe&&vh),children:W.jsx(Sh,{style:{transform:"scale(1.5)"},children:"Ad"})}),W.jsxs(B0,{children:[W.jsx(x0,{time:v,adCount:D,adPosition:L}),!!O&&U&&W.jsx(X.y,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{C()},duration:O,isPlaying:!F,skipIcon:!0}),n&&W.jsx(X.y,{className:"ClosePromoIcon",close:()=>{N(),e==null||e()}})]})]}),W.jsx(Th,{className:X.cx_default(bc,U&&vc,!U&&Tc),children:W.jsxs(M0,{ref:g,children:[ie&&W.jsx(D0,{whyThisAd:ie}),W.jsxs(P0,{style:(ie==null?void 0:ie.xPosition)==="right"?{left:"8px"}:{right:"8px"},children:[J&&W.jsx(N0,{className:X.cx_default(!V&&"muted"),onClick:()=>S()}),F&&!Y&&W.jsx(U0,{onClick:()=>w()})]})]})}),he&&W.jsx(Eh,{className:X.cx_default(bc,U&&vc,!U&&Tc),children:W.jsx(wh,{as:"button",onClick:le,style:{backgroundColor:((l=(a=i.banner)==null?void 0:a.ctaButton)==null?void 0:l.color)||"#009dc4",color:((p=(u=i.banner)==null?void 0:u.ctaButton)==null?void 0:p.textColor)||"#fff"},"data-a":"button","data-promo-id":t,"data-promo-type":i.type,target:"_blank",children:"Show more"})})]})},gh=i=>{var e,t,r,n,s,a,l,u,p,g,b,S,w,C,v,D,L,O,U,F,N,V,J,Y,ie,he,le,pe,ee,ce;const{promotion:ne,open:de,advertisementPaused:we,togglePause:ze,controlVideo:dt,skipAutoClose:Ot,promotionId:ht,onClose:Ut,markAsViewed:Vt,externalAd:xe}=i,Fe=ne.type===ge.PromotionType.INGAME_IAB11_LBAR||ne.type===ge.PromotionType.INGAME_IAB11,oi=((e=ne.sponsor)==null?void 0:e.logo)&&ne.logoMode===ge.PromotionLogoMode.CENTER,Fi=!!((r=(t=ne.banner)==null?void 0:t.video)!=null&&r.url),li=ne.autoPlayVideo===ge.AutoPlayVideo.ENABLED;if(Me.useEffect(()=>{ze==null||ze(Fi||li),de==null||de()},[]),Me.useEffect(()=>{ht&&ne.type&&Vt&&Vt()},[ht,ne.type,Vt]),Me.useEffect(()=>()=>{dt==null||dt({muted:!1})},[dt]),xe)return W.jsx(B2,{...i,externalAd:xe});let Ht=(n=ne.banner)==null?void 0:n.url;Ht&&Ht.indexOf("http")!==0&&(Ht=`https://${Ht}`);let Ti=!0;return Fi&&(!we||!li?Ti=!0:Ti=!1),W.jsxs(yh,{className:"PromoOverlay",children:[W.jsxs(_h,{children:[W.jsxs(bh,{className:X.cx_default(!oi&&vh),children:[((s=ne.sponsor)==null?void 0:s.logo)&&ne.logoMode===ge.PromotionLogoMode.LEFT&&W.jsx(fc,{className:"PromoSponsorLogo",src:(a=ne.sponsor)==null?void 0:a.logo,alt:"promo"}),W.jsxs(S0,{style:{paddingLeft:(l=ne.sponsor)!=null&&l.logo&&ne.logoMode===ge.PromotionLogoMode.LEFT?"0px":"8px"},children:[((u=ne.sponsor)==null?void 0:u.logo)&&ne.logoMode===ge.PromotionLogoMode.LEFT&&W.jsx(_0,{children:(p=ne.sponsor)==null?void 0:p.name}),W.jsxs(E0,{className:"SponsorText",children:[W.jsx(Sh,{children:"AD"}),W.jsx(w0,{children:"SPONSORED"})]})]})]}),W.jsx(X.y,{className:"ClosePromoIcon",close:Ut,autoClose:(g=ne.closeTimer)==null?void 0:g.auto,duration:Ot?0:(b=ne.closeTimer)==null?void 0:b.seconds,isPlaying:Ti})]}),W.jsxs(Th,{children:[oi&&W.jsx(fc,{className:v0,src:(S=ne.sponsor)==null?void 0:S.logo,alt:"promo"}),W.jsx(yc,{children:(C=(w=ne.banner)==null?void 0:w.video)!=null&&C.url?W.jsx(X.R$1,{source:(D=(v=ne.banner)==null?void 0:v.video)==null?void 0:D.url,poster:(O=(L=ne.banner)==null?void 0:L.video)==null?void 0:O.thumbnailUrl,aspectRatio:Fe?"1/1":"16/9",onPause:()=>{li&&(ze==null||ze(!0))},onPlay:()=>{X.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:ht,type:ne.type}}),ze==null||ze(!1)},controlVideo:dt,autoPlay:li}):(U=ne.banner)!=null&&U.imageUrl?W.jsx(b0,{style:Fe?{aspectRatio:"1/1"}:{},src:(F=ne.banner)==null?void 0:F.imageUrl,alt:"promo"}):null}),!Fe&&W.jsxs(yc,{children:[((N=ne.banner)==null?void 0:N.title)&&W.jsx(k0,{className:X.cx_default("AdvTitle",oi&&C0),children:(V=ne.banner)==null?void 0:V.title}),((J=ne.banner)==null?void 0:J.body)&&W.jsx(T0,{className:"AdvDescription",children:(Y=ne.banner)==null?void 0:Y.body})]})]}),ne.buttonType!==ge.PromotionButtonType.NO_BUTTON&&W.jsx(Eh,{children:W.jsx(wh,{href:Ht,style:{backgroundColor:((he=(ie=ne.banner)==null?void 0:ie.ctaButton)==null?void 0:he.color)||"#009dc4",color:((pe=(le=ne.banner)==null?void 0:le.ctaButton)==null?void 0:pe.textColor)||"#fff"},"data-a":"button","data-promo-id":ht,"data-promo-type":ne.type,target:"_blank",children:(ce=(ee=ne.banner)==null?void 0:ee.ctaButton)==null?void 0:ce.label})})]})},F2=X.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),j2=({children:i,direction:e,style:t,className:r,hiding:n})=>W.jsx(bl,{direction:e,style:t,hiding:n,className:r,children:W.jsx(F2,{children:i})}),q2=i=>(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB11_LBAR||(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB21_LBAR,$2=i=>(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB11||(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB21,V2=({advertisement:i,close:e,skipTypeCheck:t,skipAutoClose:r,layoutMode:n="side-by-side",sidebar:s,isNotification:a,banner:l,markAsViewed:u,open:p,externalAd:g,controlVideo:b,advertisementPaused:S,togglePause:w})=>i.promotion?a&&i.notification?W.jsx(f0,{open:()=>p==null?void 0:p({fromNotification:!0}),notification:i.notification,promotionId:i.question.id}):!s&&!l&&(t||$2(i.promotion))?W.jsx(y0,{className:"PromoOverlayContainer",children:W.jsx(gh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,onClose:e,open:p,skipAutoClose:r,externalAd:g,controlVideo:b,advertisementPaused:S,togglePause:w})}):s&&(t||q2(i.promotion))?W.jsx(j2,{className:"PromoSidebarContainer",direction:s,hiding:!1,children:W.jsx(gh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,externalAd:g,onClose:e,open:p,controlVideo:b,skipAutoClose:r,advertisementPaused:S,togglePause:w})}):l?W.jsx(N_,{promotionId:i.question.id,hiding:!1,promotion:i.promotion,direction:l}):null:null,H2=X.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),z2=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")||ge.PromotionType.UNSET;e.getAttribute("data-a")==="button"&&X.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:r}}),e.getAttribute("data-a")==="banner"&&X.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:r}})}},W2=({gamification:i,layoutMode:e,skipAutoClose:t,skipTypeCheck:r,sidebar:n,banner:s,notification:a,isMobileScreen:l,persistent:u,externalAd:p,controlVideo:g})=>{var b,S,w;const C=Me.useRef(null),v=X.useStore(i.advertisement.$store);X.b$1(C,{enabled:!!v.data,event:"click",listener:z2});const D=!s&&!n;if(v.data===void 0||!u&&v.isViewed)return null;const L=((w=(S=(b=v==null?void 0:v.data)==null?void 0:b.notification)==null?void 0:S.promotion)==null?void 0:w.mode)===ge.NotificationPromotionMode.LOWER_THIRD;return W.jsx(H2,{ref:C,style:{height:D?"auto":"100%"},className:X.cx_default("SL-AdvertisementUIWrap",l&&"mobile-view",L&&"SL-AdvertisementUIWrap--lower-third"),children:W.jsx(V2,{skipTypeCheck:r,sidebar:n,banner:s,advertisement:v.data,advertisementPaused:v.isPaused,togglePause:v.togglePause,close:v.close,externalAd:p?v.externalAd:void 0,markAsViewed:i.advertisement.markAsViewed,open:i.advertisement.open,layoutMode:e,isNotification:a,skipAutoClose:t,controlVideo:g})})},lf=({sdk:i,sidebar:e,externalAd:t,banner:r,skipAutoClose:n,skipTypeCheck:s,layoutMode:a,isMobileScreen:l,persistent:u,notification:p})=>{const g=X.useStore(i.featuresList.getStore()),[b,S]=Me.useState(!t);if(Me.useEffect(()=>{if(t){const C=document.createElement("script");C.async=!0,C.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(C),C.onload=()=>{S(!0)}}},[t]),e&&r)return W.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(r&&t)return W.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!g)return null;const w=i.getFeature(ge.SdkOverlayType.GAMES);return!w||t&&!b?null:W.jsx(W2,{gamification:w,sidebar:e,banner:r,layoutMode:a,isMobileScreen:l,persistent:u,notification:p,skipTypeCheck:s,skipAutoClose:n,externalAd:t,controlVideo:i.controlVideoPlayer})},G2=({event:i,sidebar:e,banner:t,isMobileScreen:r,skipAutoClose:n,persistent:s,theme:a,notification:l,skipTypeCheck:u,externalAd:p})=>{const g=X.useStreamLayer(),b=X.useStreamLayerUI(),S=X.useStreamLayerTheme();return g?p&&!b.promotionExternalAd?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):!p&&b.promotionExternalAd?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):e&&!b.promotionSidebar?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):t&&!b.promotionBanner?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):l&&!b.promotionNotification?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):!t&&!e&&!l&&!b.promotionOverlay?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):W.jsxs("div",{className:"StreamLayerSDK",children:[W.jsx(X.h,{customTheme:a??S.theme,themeMode:S.themeMode,children:W.jsx(lf,{sdk:g,sidebar:e,banner:t,isMobileScreen:r,persistent:s,notification:l,skipTypeCheck:u,skipAutoClose:n,layoutMode:"side-by-side",externalAd:p})}),i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i})]}):null};exports.StreamLayerSDKAdvertisement=G2;exports.StreamLayerSDKAdvertisementUI=lf;
|