"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8443],{17007:function(e,t,i){i.r(t),i.d(t,{default:function(){return h}});var n=i(2265),a=i(59509),r=i(77220);class o extends(0,r.lK)(a.zM){static shadowRootOptions={...a.zM.shadowRootOptions};static getTemplateHTML=e=>{let{src:t,...i}=e;return a.zM.getTemplateHTML(i)};#e;attributeChangedCallback(e,t,i){"src"!==e&&super.attributeChangedCallback(e,t,i),"src"===e&&t!=i&&this.load()}async _initThumbnails(e){let t=async(t,i)=>{let n=[],a=e.timescale||1,r=e.startNumber||1,o=e.presentationTimeOffset?e.presentationTimeOffset/a:0,l=e.segmentDuration;for(let e=0;e<t;e++){let a=function({thIndex:e,tduration:t,thduration:i,ttiles:n,startNumber:a,pto:r}){return(Math.floor(e/n)+a-1)*t-r+(e%n+1-1)*i}({thIndex:e,thduration:i,ttiles:t,tduration:l,startNumber:r,pto:o}),s=a+i,d=new Promise((e,t)=>{this.api.provideThumbnail(a,({url:i,width:n,height:r,x:o,y:l})=>{try{let t=new VTTCue(a,s,`${i}#xywh=${o},${l},${n},${r}`);e(t)}catch(e){t(e)}})});n.push(d)}return await Promise.all(n).catch(e=>console.error("Error processing thumbnails",e))},{totalThumbnails:i,thumbnailDuration:n}=function(e){var t,i;let[n,a]=e.essentialProperties[0].value.split("x").map(Number),r=(null==(i=null==(t=e.adaptation)?void 0:t.period)?void 0:i.duration)||null,o=e.segmentDuration,l=o/(e.timescale||1)/(n*a);return{totalThumbnails:null!=r?Math.ceil(r/l):Math.ceil(o/l),thumbnailDuration:l}}(e),a=await t(i,n),r=this.nativeEl.querySelector('track[label="thumbnails"]');if(!r){r=function(){let e=document.createElement("track");return e.kind="metadata",e.label="thumbnails",e.srclang="en",e.mode="hidden",e.default=!0,e}(),this.nativeEl.appendChild(r);let e=function(e){let t="WEBVTT\n\n";for(let i of e)t+=`${n(i.startTime)} --> ${n(i.endTime)}
${i.text}

`;let i=new Blob([t],{type:"text/vtt"});return URL.createObjectURL(i);function n(e){let t=String(Math.floor(e/3600)).padStart(2,"0"),i=String(Math.floor(e%3600/60)).padStart(2,"0"),n=(e%60).toFixed(3).padStart(6,"0");return`${t}:${i}:${n}`}}(a);r.src=e,r.dispatchEvent(new Event("change"))}}async load(){if(this.#e){this.api.attachSource(this.src);return}this.#e=!0;let e=await i.e(8774).then(i.bind(i,40774));this.api=e.MediaPlayer().create(),this.api.initialize(this.nativeEl,this.src,this.autoplay),this.api.on(e.MediaPlayer.events.STREAM_INITIALIZED,()=>{let e=this.api.getRepresentationsByType("video"),t=this.videoTracks.getTrackById("main");t||((t=this.addVideoTrack("main")).id="main",t.selected=!0),e.forEach(e=>{let i=e.bandwidth??e.bitrate??(Number.isFinite(e.bitrateInKbit)?1e3*e.bitrateInKbit:void 0);t.addRendition(e.id,e.width,e.height,e.mimeType??e.codec,i).id=e.id}),this.videoRenditions.addEventListener("change",()=>{let e=this.videoRenditions[this.videoRenditions.selectedIndex];(null==e?void 0:e.id)?(this.api.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!1}}}}),this.api.setRepresentationForTypeById("video",e.id,!0)):this.api.updateSettings({streaming:{abr:{autoSwitchBitrate:{video:!0}}}})}),this.api.isDynamic()||this.api.getRepresentationsByType("image").forEach(async(e,t)=>{t>0||this._initThumbnails(e)})})}}globalThis.customElements&&!globalThis.customElements.get("dash-video")&&globalThis.customElements.define("dash-video",o);var l=new Set(["style","children","ref","key","suppressContentEditableWarning","suppressHydrationWarning","dangerouslySetInnerHTML"]),s={className:"class",htmlFor:"for"};function d(e){return e.toLowerCase()}function u(e){return"boolean"==typeof e?e?"":void 0:"function"==typeof e?void 0:"object"!=typeof e||null===e?e:void 0}function c(e,t,i){var n,a;e[t]=i,null==i&&t in(null!==(a=null==(n=globalThis.HTMLElement)?void 0:n.prototype)&&void 0!==a?a:{})&&e.removeAttribute(t)}var h=function(e){let{react:t,tagName:i,elementClass:n,events:a,displayName:r,defaultProps:o,toAttributeName:h=d,toAttributeValue:p=u}=e,f=Number.parseInt(t.version)>=19,m=t.forwardRef((e,r)=>{var d,m,v,b,y;let T=t.useRef(null),g=t.useRef(new Map),w={},E={},M={},L={};for(let[t,i]of Object.entries(e)){if(l.has(t)){M[t]=i;continue}let e=h(null!==(v=s[t])&&void 0!==v?v:t);if(n.prototype&&t in n.prototype&&!(t in(null!==(b=null==(d=globalThis.HTMLElement)?void 0:d.prototype)&&void 0!==b?b:{}))&&!(null==(m=n.observedAttributes)?void 0:m.some(t=>t===e))){L[t]=i;continue}if(t.startsWith("on")){w[t]=i;continue}let a=p(i);e&&null!=a&&(E[e]=String(a),f||(M[e]=a)),e&&f&&(a!==u(i)?M[e]=a:M[e]=i)}if("undefined"!=typeof window){for(let e in w){let i=w[e],n=e.endsWith("Capture"),r=(null!==(y=null==a?void 0:a[e])&&void 0!==y?y:e.slice(2).toLowerCase()).slice(0,n?-7:void 0);t.useLayoutEffect(()=>{let e=null==T?void 0:T.current;if(e&&"function"==typeof i)return e.addEventListener(r,i,n),()=>{e.removeEventListener(r,i,n)}},[null==T?void 0:T.current,i])}t.useLayoutEffect(()=>{if(null===T.current)return;let e=new Map;for(let t in L)c(T.current,t,L[t]),g.current.delete(t),e.set(t,L[t]);for(let[e,t]of g.current)c(T.current,e,void 0);g.current=e})}if("undefined"==typeof window&&(null==n?void 0:n.getTemplateHTML)&&(null==n?void 0:n.shadowRootOptions)){let{mode:i,delegatesFocus:a}=n.shadowRootOptions,r=t.createElement("template",{shadowrootmode:i,shadowrootdelegatesfocus:a,dangerouslySetInnerHTML:{__html:n.getTemplateHTML(E,e)},key:"ce-la-react-ssr-template-shadow-root"});M.children=[r,M.children]}return t.createElement(i,{...o,...M,ref:t.useCallback(e=>{T.current=e,"function"==typeof r?r(e):null!==r&&(r.current=e)},[r])},M.children)});return m.displayName=null!=r?r:n.name,m}({react:n,tagName:"dash-video",elementClass:o,toAttributeName:e=>"muted"===e?"":"defaultMuted"===e?"muted":d(e)})}}]);