(function(){"use strict";const le=':root{--player-controls-background-color: rgba(0, 0, 0, .2);--player-progress-value: 0;--player-volume-value: 0}div#mn-video-player-container.mn-adv-started>button#mn-play-button,div#mn-video-player-container.mn-adv-started>div#mn-controls-container{display:none!important}div#mn-controls-container.visible{height:20%;min-height:45px}div#mn-controls-container.visible>div#mn-info-and-buttons-container{display:flex}div#mn-controls-container.visible div#mn-subtitle-list-container.visible{display:flex}button#mn-play-button.visible{opacity:1}button#mn-play-button{background-color:var(--player-controls-background-color);left:50%;max-width:80px;min-width:40px;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%);transition:opacity .5s;width:15%;z-index:2}button#mn-play-button>svg{width:75%}div#mn-controls-container{align-items:center;background-color:var(--player-controls-background-color);bottom:0;display:flex;flex-direction:column;max-height:60px;position:absolute;width:100%;z-index:2}div#mn-subtitle-list-container{-webkit-backdrop-filter:blur(5px);backdrop-filter:blur(5px);background-color:var(--player-controls-background-color);border-radius:10px;border:1px solid white;bottom:100%;color:#fff;display:none;flex-direction:column;font-family:Verdana,sans-serif;font-size:small;gap:5px;padding:10px;position:absolute;right:5%}div.mn-subtitle-option{border-radius:5px;cursor:pointer;padding:5px}div.mn-subtitle-option.enabled{color:var(--player-color)}div.mn-subtitle-option:not(.enabled):hover{background:#ffffff14}video#mn-outstream-video-player::cue{line-height:55px}video#mn-outstream-video-player.controls-visible::cue{line-height:100px}input#mn-progress-bar,input#mn-controls-volume{-webkit-appearance:none;background:linear-gradient(to right,var(--player-color) 100%,transparent 100%) no-repeat;border-radius:4px;height:8px;margin:0}input#mn-progress-bar::-webkit-slider-runnable-track,input#mn-controls-volume::-webkit-slider-runnable-track{border-radius:4px;border:1px solid white;cursor:pointer;height:100%}input#mn-progress-bar::-webkit-slider-thumb,input#mn-controls-volume::-webkit-slider-thumb{-webkit-appearance:none;background-color:var(--player-color);border-radius:50%;cursor:pointer;height:14px;margin-top:-4.5px;width:14px}input#mn-progress-bar::-moz-range-track,input#mn-controls-volume::-moz-range-track{border-radius:4px;border:1px solid white;cursor:pointer;height:100%}input#mn-progress-bar::-moz-range-thumb,input#mn-controls-volume::-moz-range-thumb{background-color:var(--player-color);border-radius:50%;cursor:pointer;height:14px;margin-top:-4.5px;width:14px}div#mn-progress-bar-container{width:95%}input#mn-progress-bar{background-size:var(--player-progress-value) 100%;width:100%}div#mn-info-and-buttons-container{align-items:center;display:none;height:100%;width:95%}div#mn-video-info-container{align-items:center;display:flex;height:100%;margin-right:20px}span.mn-video-timer{color:#fff;font-family:Verdana,sans-serif;font-size:smaller}span#mn-video-duration:before{content:"/";margin:0 5px}div#mn-buttons-container{align-items:center;display:flex;width:100%}div#mn-volume-container{align-items:center;display:flex;width:50%}input#mn-controls-volume.visible{opacity:1}input#mn-controls-volume{background-size:var(--player-volume-value) 100%;margin-left:5px;opacity:0;transition:opacity .5s;width:50%}div#mn-options-container{align-items:center;display:flex;justify-content:flex-end;width:50%}button#mn-subtitle-button{margin-right:20px}button.mn-controls-button{align-items:center;background:none;border-radius:5px;border:0;color:#fff;cursor:pointer;display:flex;justify-content:center;padding:0;width:20px}button.mn-controls-button>svg{width:100%}div#mn-video-player-container.fullscreen-mode input#mn-controls-volume{width:25%!important}div#mn-outstream-container.mn-incontent.mn-small-incontent-type div#mn-volume-container{width:65%!important}div#mn-outstream-container.mn-incontent.mn-small-incontent-type div#mn-options-container{width:35%!important}:root{--player-color: rgb(96, 45, 53);--player-inslide-height: calc((var(--player-inslide-width) / 16) * 9);--player-inslide-mobile-height: calc((var(--player-inslide-mobile-width) / 16) * 9);--player-inslide-mobile-width: 250px;--player-inslide-offset-bottom: 10px;--player-inslide-offset-top: 10px;--player-inslide-width: 445px}div#mn-outstream-container *{box-sizing:border-box}div#mn-outstream-container{background-color:#000!important}div#mn-outstream-container.mn-incontent{width:100%}div#mn-outstream-container.mn-incontent div#mn-close-button{display:none}div#mn-outstream-container.mn-inslide{bottom:var(--player-inslide-offset-bottom);position:fixed;width:var(--player-inslide-width);z-index:9999}div#mn-outstream-container.mn-inslide.mn-position-right{right:15px;transition:right .3s linear}div#mn-outstream-container.mn-inslide.mn-offscreen-right{right:-1000px;transition:right .3s linear}div#mn-outstream-container.mn-inslide.mn-position-left{left:15px;transition:left .3s linear}div#mn-outstream-container.mn-inslide.mn-offscreen-left{left:-1000px;transition:left .3s linear}div#mn-outstream-container.mn-inslide.mn-position-center{bottom:var(--player-inslide-offset-bottom);left:50%;transform:translate(-50%);transition:bottom .3s linear}div#mn-outstream-container.mn-inslide.mn-offscreen-center{bottom:-1000px;transition:bottom .3s linear}div#mn-outstream-container.mn-inslide.mn-position-top{bottom:unset;left:50%;top:var(--player-inslide-offset-top);transform:translate(-50%);transition:top .3s linear}div#mn-outstream-container.mn-inslide.mn-offscreen-top{bottom:unset;top:-1000px;transition:top .3s linear}div#mn-video-player-container{display:flex;height:100%;position:relative;width:100%}video#mn-outstream-video-player{width:100%}div#mn-outstream-container.mn-inslide video#mn-outstream-video-player{height:var(--player-inslide-height)}div#mn-outstream-container div#mn-close-button{background-color:var(--player-color);border-radius:50%;color:#fff;cursor:pointer;font-family:sans-serif;position:absolute;text-align:center;vertical-align:middle;width:25px;z-index:1000}div#mn-outstream-container.mn-inslide div#mn-close-button{font-size:15px;line-height:25px;width:25px}div#mn-close-button.bottom-right{bottom:0;right:0;transform:translate(50%,50%)}div#mn-close-button.bottom-left{bottom:0;left:0;transform:translate(-50%,50%)}div#mn-close-button.top-right{right:0;top:0;transform:translate(50%,-50%)}div#mn-close-button.top-left{left:0;top:0;transform:translate(-50%,-50%)}div#mn-title-container,div#mn-injected-title-container{background-color:#000;color:#fff;font-family:sans-serif;font-weight:600;padding:5px;position:relative;text-align:left;width:100%}div#mn-title-container p,div#mn-injected-title-container p{margin:0}div#mn-title-container p#mn-title-text{overflow-wrap:break-word}p#mn-title-text.mn-hidden-text-overflow{overflow:hidden;overflow-wrap:unset!important;text-overflow:ellipsis;white-space:nowrap}div#mn-adv-container{height:100%;left:0;position:absolute;top:0;width:100%;z-index:3}div#mn-adv-container.adv-paused>button#mn-adv-play-button{opacity:1}button#mn-adv-play-button{background-color:#0003;left:50%;max-width:80px;min-width:40px;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%);width:15%}button#mn-adv-close-button{position:absolute;top:10px}button#mn-adv-close-button.mn-adv-close-position-left{left:10px}button#mn-adv-close-button.mn-adv-close-position-right{right:10px}div#mn-adv-controls-container{bottom:5px;display:flex;justify-content:space-between;padding:5px 20px;position:absolute;width:100%;z-index:3}button#mn-adv-close-button,div#mn-adv-controls-container>button.mn-controls-button{max-width:25px;min-width:15px;width:25%}button#mn-adv-close-button svg,div#mn-adv-controls-container>button.mn-controls-button svg{filter:drop-shadow(0px 0px 1px black);width:100%}video#mn-test-video{display:none}div#mn-video-player-container.mn-adv-started div#mn-injected-container{display:none!important}div#mn-injected-container{align-items:center;display:flex;height:100%;justify-content:center;left:0;position:absolute;top:0;width:100%}div#mn-injected-container.slot-render-ended{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);z-index:3}div#mn-video-player-container.fullscreen-mode video#mn-outstream-video-player{height:100%!important}.mn-status-hidden{display:none!important}.mn-max-width{width:100%!important}@media only screen and (max-width:768px){div#mn-outstream-container.mn-inslide{width:var(--player-inslide-mobile-width)}div#mn-outstream-container.mn-inslide video#mn-outstream-video-player{height:var(--player-inslide-mobile-height)!important}div#mn-title-container,div#mn-injected-title-container{font-size:11px;font-weight:400}}',de=`
`,B=`
`,z=`
`,ue=`
`,ce=`
`,he=`
`,me=`
`,N=`
`,pe=`
`,ge=`
`;function M(i){const e=Math.floor(i/60),t=Math.floor(i%60);return t<10?`${e}:0${t}`:`${e}:${t}`}function q({formattedVideoCurrentTime:i,formattedVideoTotalTime:e}){const t=i||"0:00",n=e||"0:00",s=t.split(":"),o=n.split(":");return`${s[0]} Minuti ${s[1]} Secondi di ${o[0]} Minuti ${o[1]} Secondi`}function W({adsManagerResize:i,debugService:e,videoContainer:t,videoElement:n}){if(document.fullscreenElement){document.exitFullscreen().then(()=>{t.classList.remove("fullscreen-mode"),i({height:t.clientHeight,width:t.clientWidth})}).catch(r=>e.debug("Error exiting Full screen mode",r));return}try{const r=window.screen.orientation.type.startsWith("portrait")?"portrait":"any";window.screen.orientation.lock(r)}catch(r){e.debug("Screen orientation error:",r)}let s=!1;const o=_?t:n;typeof o.requestFullscreen=="function"?(o.requestFullscreen(),s=!0):typeof o.mozRequestFullScreen=="function"?(o.mozRequestFullScreen(),s=!0):typeof o.webkitRequestFullscreen=="function"?(o.webkitRequestFullscreen(),s=!0):typeof o.msRequestFullscreen=="function"?(o.msRequestFullscreen(),s=!0):o.webkitSupportsFullscreen&&typeof o.webkitEnterFullScreen=="function"&&(o.webkitEnterFullScreen(),s=!0),s&&(t.classList.add("fullscreen-mode"),i({height:window.screen.height,width:window.screen.width,viewMode:"FULLSCREEN"}))}function be({progressBar:i,videoElement:e}){window.requestAnimationFrame(()=>{const t=Math.floor(e.currentTime/e.duration*100);i.value=String(t),i.style.setProperty("--player-progress-value",`${t}%`)})}function F(i){window.requestAnimationFrame(()=>{const e=Math.floor(Number(i.value)*100);i.setAttribute("aria-valuetext",`${e}% volume`),i.style.setProperty("--player-volume-value",`${e}%`)})}let I,U=!1;function ve({debugService:i,fullScreenButton:e,progressBar:t,videoContainerElement:n,videoCurrentTime:s,videoElement:o,videoTotalTime:r}){t.oninput=()=>{U=!0,o.paused||o.pause();const a=Number(t.value)/100*o.duration,p=M(a);s.innerHTML=p,t.setAttribute("aria-valuenow",`${q({formattedVideoCurrentTime:p,formattedVideoTotalTime:I})}`),t.style.setProperty("--player-progress-value",`${t.value}%`)},t.onchange=()=>{U=!1;const a=Number(t.value)/100*o.duration,p=M(a);o.currentTime=a,t.setAttribute("aria-valuenow",`${q({formattedVideoCurrentTime:p,formattedVideoTotalTime:I})}`),o.paused&&P(o).then(()=>i.debug("Starting video content")).catch(g=>i.warn("Error while starting video content",g))},o.preload="metadata",o.onloadedmetadata=()=>{try{const l=Number.isFinite(o.currentTime)?M(o.currentTime):"";I=Number.isFinite(o.duration)?M(o.duration):"",s.innerHTML=l,r.innerHTML=I,t.setAttribute("aria-valuenow",`${q({formattedVideoCurrentTime:l,formattedVideoTotalTime:I})}`)}catch(l){i.debug("On load metadata error, no value is set for videoTotalTime and videoCurrentTime",l)}},o.addEventListener("play",()=>{n.classList.add("mn-video-started"),n.classList.contains("mn-content-resume")&&e.classList.remove("mn-status-hidden")},{once:!0,passive:!0}),o.ontimeupdate=()=>{if(U)return;const l=M(o.currentTime);s.innerHTML=l,t.setAttribute("aria-valuenow",`${q({formattedVideoCurrentTime:l,formattedVideoTotalTime:I})}`),be({progressBar:t,videoElement:o})}}let ee;function Q({controlsContainer:i,playButton:e,videoElement:t}){i.classList.contains("visible")||(e.classList.add("visible"),i.classList.add("visible"),t.classList.add("controls-visible")),clearTimeout(ee),ee=setTimeout(()=>{t.paused||(e.classList.remove("visible"),i.classList.remove("visible"),t.classList.remove("controls-visible"))},5e3)}function te({debugService:i,toggleVideoAutoPlay:e,videoElement:t}){t.paused?P(t).then(()=>i.debug("Starting video content")).catch(n=>i.warn("Error while starting video content",n)):D(t,i),e()}function K({debugService:i,label:e,subtitleListContainer:t,videoElement:n}){try{e==="Off"?i.debug("Disabling subtitles"):i.debug(`Enabling subtitles for: ${e}`);const s=t.querySelectorAll("div.mn-subtitle-option");for(const r of s)r.getAttribute("data-label")===e?(r.classList.add("enabled"),r.setAttribute("aria-selected","true")):(r.classList.remove("enabled"),r.setAttribute("aria-selected","false"));const o=n.textTracks;for(const r of o){if(r.label!==e){r.mode="disabled";continue}r.mode="showing"}}catch(s){i?.debug?.("Toggle subtitles error",s)}t.classList.remove("visible")}function ie(i,e){if(i.paused){e.innerHTML=N,e.setAttribute("aria-label","Riproduci video");return}e.innerHTML=me,e.setAttribute("aria-label","Metti in pausa il video")}let R=0;function G({debugService:i,iconClicked:e,onKeyBoardEvent:t,videoElement:n,volumeButton:s,volumeInput:o}){const r=o!=null;if(e||t)i.debug("Updating volume with click on icon or with keyboard"),n.muted?(R===0&&(R=.4),n.muted=!1,n.volume=R,r&&(o.value=String(R))):(R=n.volume,n.muted=!0,n.volume=0,r&&(o.value="0")),r&&F(o);else{i.debug("Updating volume with the input bar");const l=Number(o.value);R=l,n.volume=l,n.muted=n.volume===0}i.debug(`Volume updated to ${n.volume}`),s.innerHTML=$({volume:n.volume,volumeButton:s})}function $({volume:i,volumeButton:e}){if(i===0)return e.setAttribute("aria-pressed","false"),he;if(e.setAttribute("aria-pressed","true"),i>0&&i<=.5)return ce;if(i>.5)return ue}class S{device;static DeviceType={DESKTOP:"desktop",TABLET:"tablet",MOBILE:"mobile"};constructor(e){this.isDesktopWidth(e)?this.device=S.DeviceType.DESKTOP:this.isTabletWidth(e)?this.device=S.DeviceType.TABLET:this.device=S.DeviceType.MOBILE}get deviceType(){return this.device}isDesktopWidth(e){return e>=1025}isTabletWidth(e){return e<1025&&e>=768}}const ne=new S(window.innerWidth).deviceType,_=ne===S.DeviceType.DESKTOP,fe=ne===S.DeviceType.MOBILE;function O(i){return!!new URLSearchParams(window.location.search).get(i)}function ye(i){try{return window.localStorage.getItem(i)}catch(e){return console.error(`Error while getting ${i} from local storage`,e),null}}function we(){typeof window.mnPlayerQueue=="object"&&Array.isArray(window.mnPlayerQueue.queue)||(window.mnPlayerQueue={queue:[]})}function Ce(){typeof window.mnPlayerQueue=="object"&&Array.isArray(window.mnPlayerQueue.queue)?window.mnPlayerQueue.queue.forEach(function(e){e()}):we(),Ae()}function Ae(){window.mnPlayerQueue.queue={},window.mnPlayerQueue.queue.push=function(e){e()},Object.freeze(window.mnPlayerQueue)}function d({elementType:i="div",elementId:e,className:t}={}){const n=document.createElement(i);return e!=null&&(n.id=e),t!=null&&n.classList.add(t),n}let X=!1;function Te({playerControls:i,videoContentTitle:e,videoElement:t}){t.onplay=()=>{i?.playButton!=null&&ie(t,i.playButton);const n=X?"video-resumed":"video-started";X||(X=!0),Y({type:n,videoContentTitle:e,videoElement:t})},t.onpause=()=>{i?.playButton!=null&&ie(t,i.playButton),Y({type:"video-paused",videoContentTitle:e,videoElement:t})},t.addEventListener("ended",()=>{i!=null&&(i.playButton.innerHTML=pe,i.playButton.classList.add("visible"),i.controlsContainer.classList.add("visible")),Y({type:"video-ended",videoContentTitle:e,videoElement:t})},{passive:!0})}function Y({type:i,videoContentTitle:e,videoElement:t}){window.dispatchEvent(new CustomEvent(i,{detail:{event:i,title:e,video_duration:M(t.duration),event_raised_at:performance.now()}}))}function y(){return new Promise(i=>{if("scheduler"in window&&typeof window.scheduler=="object"&&window.scheduler!=null){if("yield"in window.scheduler&&typeof window.scheduler.yield=="function")return window.scheduler.yield().then(()=>i(!0));if("postTask"in window.scheduler&&typeof window.scheduler.postTask=="function")return window.scheduler.postTask(()=>i(!0),{priority:"user-visible"})}setTimeout(()=>i(!0),0)})}const se=new WeakMap;function D(i,e){const t=se.get(i);return t?t.then(()=>{i.pause()}).catch(n=>{e.warn("The video was not paused, its play() failed:",n)}):(e.warn("Attempting to pause the video can not be accomplished, this may indicate that play was never called."),Promise.resolve())}function P(i){const e=new Promise((t,n)=>{try{const s=i.play();s!==void 0&&typeof s.then=="function"?s.then(()=>t()).catch(o=>n(o)):t()}catch(s){n(s)}});return se.set(i,e),e}function Ee({adsManagerResize:i,debugService:e,isAdTagUrlDefined:t,isDesktop:n,isMobile:s,subtitles:o,toggleVideoAutoPlay:r,videoContainerElement:l,videoElement:a}){const p=d({elementId:"mn-buttons-container"}),g=d({elementId:"mn-controls-container"}),u=d({elementId:"mn-info-and-buttons-container"}),c=d({elementId:"mn-options-container"}),m=d({elementId:"mn-progress-bar-container"}),f=d({elementId:"mn-video-info-container"}),L=d({elementId:"mn-volume-container"}),v=d({elementType:"button",elementId:"mn-play-button",className:"mn-controls-button"});v.setAttribute("data-title","Play (k)"),v.setAttribute("aria-keyshortcuts","k"),v.setAttribute("aria-label","Riproduci video"),v.innerHTML=N,a.paused&&(v.classList.add("visible"),g.classList.add("visible"),a.classList.add("controls-visible"));const T=d({elementType:"input",elementId:"mn-progress-bar"});T.type="range",T.name="video-progress",T.min="0",T.max="100",T.step="0.01",T.value="0";const k=d({elementType:"span",elementId:"mn-video-current-time",className:"mn-video-timer"}),A=d({elementType:"span",elementId:"mn-video-duration",className:"mn-video-timer"}),h=d({elementType:"button",elementId:"mn-volume-button",className:"mn-controls-button"});h.setAttribute("data-title","Volume (m)"),h.setAttribute("aria-keyshortcuts","m"),h.setAttribute("aria-label","Attiva audio video"),h.innerHTML=$({volume:a.volume,volumeButton:h}),h.onclick=async()=>{await y(),G({debugService:e,iconClicked:!0,onKeyBoardEvent:!1,videoElement:a,volumeButton:h,volumeInput:b})};let b;s||(b=d({elementType:"input",elementId:"mn-controls-volume"}),b.type="range",b.name="volume",b.min="0",b.max="1",b.step="0.05",b.value=String(a.volume),F(b),b.oninput=()=>F(b),b.onchange=()=>{G({debugService:e,iconClicked:!1,onKeyBoardEvent:!1,videoElement:a,volumeButton:h,volumeInput:b})},L.onmouseover=()=>b.classList.add("visible"),L.onmouseleave=()=>b.classList.remove("visible"));let E,C;if(o.enableSubtitles&&Array.isArray(o.subtitleTrackList)){E=d({elementType:"button",elementId:"mn-subtitle-button",className:"mn-controls-button"}),E.setAttribute("data-title","Sottotitoli (c)"),E.setAttribute("aria-keyshortcuts","c"),E.setAttribute("aria-label","Attiva sottotitoli"),E.innerHTML=ge,C=d({elementId:"mn-subtitle-list-container"}),C.onmouseleave=()=>C.classList.remove("visible");const x=d({className:"mn-subtitle-option"});x.innerText="Off",x.setAttribute("data-label","Off"),x.onclick=async()=>{await y(),K({debugService:e,label:"Off",subtitleListContainer:C,videoElement:a})},C.appendChild(x);for(const H of o.subtitleTrackList){const V=d({className:"mn-subtitle-option"});V.innerText=H.label,V.setAttribute("data-label",H.label),V.onclick=async()=>{await y(),K({debugService:e,label:H.label,subtitleListContainer:C,videoElement:a})},C.appendChild(V)}setTimeout(()=>{K({debugService:e,label:o.defaultSubtitle,subtitleListContainer:C,videoElement:a})},0),E.onclick=async()=>{if(await y(),C.classList.contains("visible")){e.debug("Hiding subtitle list"),C.classList.remove("visible");return}e.debug("Showing subtitle list"),C.classList.add("visible")}}const w=d({elementType:"button",elementId:"mn-fullscreen-button",className:"mn-controls-button"});return w.setAttribute("data-title","Fullscreen (f)"),w.setAttribute("aria-keyshortcuts","f"),w.setAttribute("aria-label","Attiva modalità schermo intero"),w.setAttribute("aria-pressed","false"),w.innerHTML=B,!n&&t&&w.classList.add("mn-status-hidden"),l.onfullscreenchange=()=>{if(!document.fullscreenElement){e.debug("Exited from Full screen mode"),l.classList.remove("fullscreen-mode"),w.setAttribute("aria-pressed","false"),w.innerHTML=B,i({height:l.clientHeight,width:l.clientWidth});return}e.debug("Enter in Full screen mode"),w.setAttribute("aria-pressed","true"),w.innerHTML=z,Q({controlsContainer:g,playButton:v,videoElement:a}),l.onmousemove=()=>Q({controlsContainer:g,playButton:v,videoElement:a})},l.onfullscreenerror=x=>e.error("fullscreenerror",x),n?(v.onclick=async()=>{await y(),te({debugService:e,toggleVideoAutoPlay:r,videoElement:a})},w.onclick=async()=>{await y(),W({adsManagerResize:i,debugService:e,videoContainer:l})},l.onmouseover=()=>{document.fullscreenElement||(v.classList.add("visible"),g.classList.add("visible"),a.classList.add("controls-visible"))},l.onmouseleave=()=>{!a.paused&&!document.fullscreenElement&&(v.classList.remove("visible"),g.classList.remove("visible"),a.classList.remove("controls-visible")),C?.classList.remove("visible")}):(v.onpointerup=async()=>{await y(),te({debugService:e,toggleVideoAutoPlay:r,videoElement:a}),!a.paused&&(v.classList.remove("visible"),g.classList.remove("visible"),a.classList.remove("controls-visible"))},w.onpointerup=async()=>{await y(),W({adsManagerResize:i,debugService:e,videoElement:a})},l.onpointerdown=async()=>{await y(),Q({controlsContainer:g,playButton:v,videoElement:a})}),ve({debugService:e,fullScreenButton:w,progressBar:T,videoContainerElement:l,videoCurrentTime:k,videoElement:a,videoTotalTime:A}),m.appendChild(T),f.appendChild(k),f.appendChild(A),L.appendChild(h),b!=null&&L.appendChild(b),E!=null&&c.appendChild(E),c.appendChild(w),p.appendChild(L),p.appendChild(c),u.appendChild(f),u.appendChild(p),C!=null&&g.appendChild(C),g.appendChild(m),g.appendChild(u),l.appendChild(v),l.appendChild(g),{controlsContainer:g,fullScreenButton:w,playButton:v,subtitleButton:E,volumeButton:h,volumeInput:b}}function Le(i,e){if(window.Hls)return Promise.resolve(window.Hls);let t;try{t=new Function("specifier","return import(specifier);")}catch{t=null}return t&&e?t(e).then(n=>n.default||n).catch(()=>oe(i)):oe(i)}function oe(i){return new Promise((e,t)=>{const n=document.createElement("script");n.src=i,n.onload=()=>e(window.Hls),n.onerror=()=>t(new Error(`Failed to load HLS library from: ${i}`)),document.head.appendChild(n)})}async function ke({debugService:i,hlsEsmLibraryUrl:e,hlsLibraryUrl:t,source:n,subtitles:s,videoElement:o,vipSource:r}){return new Promise(l=>{if(n==null){i.debug("Video source NOT found, using the default vipSource"),J({source:r,type:"video/mp4",videoElement:o}),l();return}i.debug("Video source found");const a="mp4",p="m3u8";switch(n.split(".").pop()){case a:{i.debug(`Video extension is ${a}`),J({source:n,type:"video/mp4",videoElement:o}),l();break}case p:{i.debug(`Video extension is ${p}, loading HLS library dynamically`),Le(t,e).then(u=>{if(!u.isSupported())return re({debugService:i,source:n,videoElement:o});i.debug("Hls.js is supported");const c=new u;c.loadSource(n),c.attachMedia(o),c.on(u.Events.MEDIA_ATTACHED,()=>i.debug("HLS media attached")),c.on(u.Events.MANIFEST_PARSED,(m,f)=>{i.debug(`HLS manifest loaded, found ${f.levels.length} quality level`)}),c.on(u.Events.ERROR,(m,f)=>{if(i.debug("HLS error encountered",f),f.fatal)switch(i.debug("HLS fatal error encountered, trying to recover"),f.type){case u.ErrorTypes.NETWORK_ERROR:{i.error("HLS fatal network error encountered",m),c.startLoad();break}case u.ErrorTypes.MEDIA_ERROR:{i.error("HLS fatal media error encountered",m),c.recoverMediaError();break}default:i.error("HLS fatal error cannot be recovered, destroying Hls instance",m),c.destroy()}}),l()}).catch(u=>{i.error("Failed to load HLS library",u),re({debugService:i,source:n,videoElement:o}),l()});break}default:{i.error(`Video extension is not supported. Supported extensions are: ${a}, ${p}`),l();return}}s.enableSubtitles&&Pe({debugService:i,subtitleTrackList:s.subtitleTrackList,videoElement:o})})}function J({source:i,type:e,videoElement:t}){const n=d({elementType:"source"});n.src=i,n.type=e,t.appendChild(n)}function re({debugService:i,source:e,videoElement:t}){if(i.debug("Hls.js is NOT supported, trying with native HLS support"),t.canPlayType("application/vnd.apple.mpegurl")){i.debug("This browser have native HLS support"),J({source:e,type:"application/vnd.apple.mpegurl",videoElement:t});return}i.error("Neither Hls.js nor native HLS are supported, exit!")}function Pe({debugService:i,subtitleTrackList:e,videoElement:t}){if(!Array.isArray(e)){i.debug("Subtitles track list is not an array, provide correct format");return}for(const n of e){const s=d({elementType:"track"});s.kind="subtitles",s.label=n.label,s.srclang=n.srclang,s.src=n.src,t.appendChild(s)}}function xe({closeButtonConfig:i,closePlayer:e,debugService:t,outstreamContainer:n}){t.debug("The close button is enabled");const s=d({elementType:"div",elementId:"mn-close-button",className:i.position});return s.setAttribute("data-title","Close (CTRL+Escape)"),s.setAttribute("aria-keyshortcuts","CTRL+Escape"),s.setAttribute("aria-label","Chiudi video"),s.innerHTML=i.text,s.onclick=async()=>{await y(),t.debug("The close button has been clicked"),e()},n.appendChild(s),s}function Se({adContainer:i,closeButton:e,event:t,fullScreenButton:n,playButton:s,volumeButton:o}){if(document.activeElement===i){if(t.code==="Space"||t.key==="k"){s?.click();return}if(t.key==="m"){o?.click();return}if(t.key==="f"){n?.click();return}if(!t.ctrlKey&&t.key==="Escape"){if(e==null)return;e.classList.contains("mn-status-hidden")||e.click()}}}async function Me({adsManagerResize:i,closeButton:e,debugService:t,event:n,outstreamContainer:s,playerContainer:o,playerControls:r,videoContainer:l,videoElement:a}){if(document.activeElement!==o&&document.activeElement!==a)return;if(n.preventDefault(),await y(),n.code==="Space"||n.key==="k"){if(a.paused)return P(a).then(()=>t.debug("Starting video content")).catch(u=>t.warn("Error while starting video content",u));const g=D(a,t);return r?.playButton.classList.add("visible"),r?.controlsContainer.classList.add("visible"),g}const p=Promise.resolve();if(n.key==="m")return G({debugService:t,iconClicked:!1,onKeyBoardEvent:!0,videoElement:a,volumeButton:r?.volumeButton,volumeInput:r?.volumeInput}),p;if(n.key==="c")return r?.subtitleButton==null||(t.debug("Toggling subtitle list with keyboard"),r.subtitleButton.click()),p;if(n.key==="ArrowDown"||n.key==="ArrowUp"||n.key==="Enter"){const g=document.getElementById("mn-subtitle-list-container");if(g==null||!g.classList.contains("visible"))return p;const u=Array.from(g.querySelectorAll(".mn-subtitle-option"));if(u.length===0)return p;if(n.key==="Enter")return u.find(L=>L.classList.contains("enabled")).click(),p;let c=u.findIndex(f=>f.classList.contains("enabled"));c===-1&&(c=0,u.forEach(f=>f.setAttribute("aria-selected","false")),u[c].classList.add("enabled"),u[c].setAttribute("aria-selected","true")),u[c].classList.remove("enabled"),u[c].setAttribute("aria-selected","false");let m;return n.key==="ArrowDown"?m=c===u.length-1?0:c+1:m=c===0?u.length-1:c-1,u[m].classList.add("enabled"),u[m].setAttribute("aria-selected","true"),p}if(n.key==="f")return W({adsManagerResize:i,debugService:t,videoContainer:l,videoElement:a}),p;if(n.ctrlKey&&n.key==="Escape"&&e!=null&&!e.classList.contains("mn-status-hidden")&&s?.classList.contains("mn-inslide"))return e.click(),p}function Ie({adContainer:i,adDefaultVolume:e,adsManager:t,adsManagerResize:n,closeAd:s,closeButtonConfig:o,debugService:r,emitEvent:l,isDesktop:a,onContentResumeRequested:p,videoContainerElement:g}){const u=d({elementType:"div",elementId:"mn-adv-controls-container"}),c=d({elementType:"button",elementId:"mn-adv-play-button",className:"mn-controls-button"});c.setAttribute("data-title","Play (k)"),c.setAttribute("aria-keyshortcuts","k"),c.setAttribute("aria-label","Riproduci video ad"),c.innerHTML=N,c.onclick=async()=>{await y(),i.classList.contains("adv-paused")&&t.resume()},i.appendChild(c);let m;const{advButtonEnabled:f,advButtonPosition:L,advButtonShowAfter:v,advButtonText:T}=o??{};f&&(m=d({elementType:"button",elementId:"mn-adv-close-button",className:"mn-controls-button"}),m.classList.add("mn-status-hidden",`mn-adv-close-position-${L}`),m.setAttribute("data-title","Close (Escape)"),m.setAttribute("aria-keyshortcuts","Escape"),m.setAttribute("aria-label","Chiudi video ad"),T==null?m.innerHTML=de:(m.innerHTML=T,m.style.color="black",m.style.maxWidth="unset",m.style.width="fit-content"),m.onclick=async()=>{await y(),s?.(),g.classList.remove("mn-adv-started"),l("AD_CLOSED"),p()},setTimeout(()=>{m?.classList.remove("mn-status-hidden")},v*1e3),i.appendChild(m));let k=t.getVolume();const A=d({elementType:"button",elementId:"mn-adv-volume-button",className:"mn-controls-button"});A.setAttribute("data-title","Volume (m)"),A.setAttribute("aria-keyshortcuts","m"),A.setAttribute("aria-label","Attiva audio video ad"),A.innerHTML=$({volume:k,volumeButton:A}),A.onclick=async()=>{await y(),r.debug("Clicked adv volume button"),k===0?(k=e,t.setVolume(e)):(k=0,t.setVolume(0)),A.innerHTML=$({volume:k,volumeButton:A})??""},u.appendChild(A);let h;a&&(h=d({elementType:"button",elementId:"mn-adv-fullscreen-button",className:"mn-controls-button"}),h.setAttribute("data-title","Fullscreen (f)"),h.setAttribute("aria-keyshortcuts","f"),h.setAttribute("aria-label","Attiva modalità schermo intero"),document.fullscreenElement?(h.setAttribute("aria-pressed","true"),h.innerHTML=z):(h.setAttribute("aria-pressed","false"),h.innerHTML=B),h.onclick=async()=>{await y(),W({adsManagerResize:n,debugService:r,videoContainer:g})},g.onfullscreenchange=()=>{if(!document.fullscreenElement){h?.setAttribute("aria-pressed","false"),h&&(h.innerHTML=B);return}h?.setAttribute("aria-pressed","true"),h&&(h.innerHTML=z)},u.appendChild(h)),i.addEventListener("keydown",b=>{try{Se({adContainer:i,closeButton:m,event:b,fullScreenButton:h,playButton:c,volumeButton:A})}catch(E){r.debug("Error inside the advAccessibilityHandler",E)}},{passive:!0}),i.appendChild(u)}const Re=8;function De(i){const e=(t,n)=>{try{const s=i?.[t]?.();return s==null||s===""?n:s}catch{return n}};return{adId:e("getAdId",null),adSystem:e("getAdSystem",null),creativeAdId:e("getCreativeAdId",null),creativeId:e("getCreativeId",null),dealId:e("getDealId",null),wrapperAdIds:e("getWrapperAdIds",[]),wrapperAdSystems:e("getWrapperAdSystems",[]),wrapperCreativeIds:e("getWrapperCreativeIds",[])}}class ae{adCountDownText;adCountDownTimer;adDisplayContainer;adsLoader;adsManager;adStarted;adTagUrl;adWillAutoPlay;adWillPlayMuted;allAdCompleted;closeButton;debugService;emitEvent;injectedTitleContainer;injectedTitleText;isExternalInjectionRunning;isPlayerInslide;isPlayerVisible;mnAdvCountDown;onContentPauseRequested;onContentResumeRequested;onImaReadyQueue;outstreamAdvContainer;outstreamContainer;playerConfig;remainingTime;showOutstreamPlayer;sourceForAutoPlayCheck;testVideoElement;titleContainer;titleText;videoContainerElement;videoElement;static injectImaScript(){const e=typeof window.google<"u"&&typeof window.google.ima<"u",t="https://imasdk.googleapis.com/js/sdkloader/ima3.js",n=document.querySelector(`script[src="${t}"]`)==null;if(e&&n)return;const s=document.createElement("script");s.src=t,document.head.appendChild(s)}constructor({adCountDownText:e,debugService:t,emitEvent:n,isPlayerInslide:s,onContentPauseRequested:o,onContentResumeRequested:r,playerConfig:l,showOutstreamPlayer:a,sourceForAutoPlayCheck:p}){this.adCountDownText=e||"Video Ansa tra",this.adStarted=!1,this.allAdCompleted=!1,this.debugService=t,this.emitEvent=n,this.isExternalInjectionRunning=!1,this.isPlayerInslide=s,this.isPlayerVisible=!1,this.onContentPauseRequested=o,this.onContentResumeRequested=r,this.onImaReadyQueue=[],this.playerConfig=l,this.showOutstreamPlayer=a,this.sourceForAutoPlayCheck=p}get areAllAdCompleted(){return this.allAdCompleted}get isAdStarted(){return this.adStarted}adsManagerPause(){this.adsManager?.pause()}adsManagerResize({height:e,width:t,viewMode:n="NORMAL"}={}){const s=e??this.videoElement?.clientHeight??0,o=t??this.videoElement?.clientWidth??0;this.adsManager?.resize(o,s,window.google.ima.ViewMode[n])}adsManagerResume(){this.adsManager?.resume()}closeAd(){this.debugService.debug("Closing the running ad"),this.allAdCompleted=!0;try{this.adsManager?.destroy()}catch(e){this.debugService.debug("Error while destroying the ads manager",e)}if(this.adsManager=void 0,clearInterval(this.adCountDownTimer),this.mnAdvCountDown!=null&&(this.mnAdvCountDown.innerHTML=""),this.titleText?.classList.remove("mn-hidden-text-overflow"),this.outstreamAdvContainer!=null)for(this.outstreamAdvContainer.classList.add("mn-status-hidden"),this.outstreamAdvContainer.classList.remove("adv-paused");this.outstreamAdvContainer.firstChild;)this.outstreamAdvContainer.firstChild.remove()}autoPlayCheckSupport(e){this.debugService.debug("Start testing for auto-play support with sound: "+(this.playerConfig.startAdWithVolume?"on":"off")),e.muted=!this.playerConfig.startAdWithVolume,e.volume=this.playerConfig.adDefaultVolume,e.play().then(()=>{this.debugService.debug("Auto-play succeeded"+(this.playerConfig.startAdWithVolume?" with sound":"")),e.pause(),this.adWillAutoPlay=!0,this.adWillPlayMuted=!this.playerConfig.startAdWithVolume,this.requestAds()}).catch(()=>{this.debugService.debug("Auto-play fails, check if video can auto-play while muted"),e.pause(),e.muted=!0,e.volume=0,e.play().then(()=>{this.debugService.debug("Auto-play succeeded while muted"),e.pause(),this.adWillAutoPlay=!0,this.adWillPlayMuted=!0,this.requestAds()}).catch(()=>{this.debugService.debug("Both muted and unmuted auto-play failed. Fallback to click to play"),e.pause(),this.adWillAutoPlay=!1,this.adWillPlayMuted=!0})})}destroyAdContainer(){this.outstreamAdvContainer!=null&&(this.debugService.debug("Destroying Adv Container"),this.outstreamAdvContainer.remove())}destroyTestVideoElement(){this.testVideoElement!=null&&(this.debugService.debug("Destroying test video element"),this.testVideoElement.remove())}detectUserInteraction(){if(this.debugService.debug("The adv is click to play, setup event listener"),_){this.outstreamContainer.addEventListener("click",async()=>{await y(),this.debugService.debug("User clicked on the video, start ad request"),this.handleAdvRequest()},{once:!0,passive:!0});return}this.outstreamContainer.addEventListener("touchstart",()=>{this.debugService.debug("User touched on the screen above the video, start ad request"),this.handleAdvRequest()},{once:!0,passive:!0})}getMnPlayerElements({closeButton:e,outstreamContainer:t,titleContainer:n,titleText:s,videoContainerElement:o,videoElement:r}){this.closeButton=e,this.outstreamContainer=t,this.titleContainer=n,this.titleText=s,this.videoContainerElement=o,this.videoElement=r}getMnPlayerInjectedElements({injectedTitleContainer:e,injectedTitleText:t}){this.injectedTitleContainer=e,this.injectedTitleText=t}getPlayerVisibility(e){this.isPlayerVisible=e}handleAdvRequest(){this.testVideoElement==null&&this.initTestVideoElement(),this.autoPlayCheckSupport(this.testVideoElement)}hideAdContainer(){this.outstreamAdvContainer!=null&&(this.debugService.debug("Adv container found, hide it"),this.outstreamAdvContainer.classList.add("mn-status-hidden"))}initTestVideoElement(){this.debugService.debug("Test video element not found, creating one"),this.testVideoElement=d({elementType:"video",elementId:"mn-test-video"}),this.testVideoElement.src=this.sourceForAutoPlayCheck,this.testVideoElement.playsInline=!0,this.testVideoElement.loop=!0,document.body.appendChild(this.testVideoElement)}isExternalInjectionActive(e){this.isExternalInjectionRunning=e}onAdError(e){this.debugService.debug("AD_ERROR",e.getError()),this.emitEvent("AD_ERROR",e)}async onAdEvent(e){switch(e.type){case window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED:{if(this.emitEvent("ALL_ADS_COMPLETED"),this.adStarted){this.debugService.debug("The ads are started and now ALL ads are COMPLETED"),this.allAdCompleted=!0;const{showAfterAdComplete:t,showAfterAdCompleteDelay:n}=this.playerConfig.closeButton;if(!this.isExternalInjectionRunning){if(t){const s=typeof n=="number"?n*1e3:0;this.debugService.debug(`Setting a timeout of ${n} seconds, before show the close button`),setTimeout(()=>{this.debugService.debug("The close button can be shown after all ads are completed"),this.closeButton?.classList.remove("mn-status-hidden")},s)}this.playerConfig.source==null&&(this.debugService.debug("Removing outstream container from the viewport because source is null"),this.outstreamContainer?.classList.add(`mn-offscreen-${this.playerConfig.playerPosition}`),this.outstreamContainer?.classList.remove(`mn-position-${this.playerConfig.playerPosition}`))}}else this.debugService.debug("Inside ALL_ADS_COMPLETED but no ad is started");if(this.outstreamAdvContainer!=null)for(this.debugService.debug("Ad container found, hide it and remove the adDisplayContainer"),this.outstreamAdvContainer.classList.add("mn-status-hidden");this.outstreamAdvContainer.firstChild;)this.outstreamAdvContainer.firstChild.remove();break}case window.google.ima.AdEvent.Type.COMPLETE:{this.debugService.debug("The current ad is COMPLETE"),this.emitEvent("AD_COMPLETE"),this.mnAdvCountDown!=null&&(this.mnAdvCountDown.innerHTML="");break}case window.google.ima.AdEvent.Type.IMPRESSION:{this.debugService.debug("The ad IMPRESSION has been pinged"),this.emitEvent("AD_IMPRESSION",De(e.getAd()));break}case window.google.ima.AdEvent.Type.LOADED:{if(this.debugService.debug("The ad is LOADED"),this.emitEvent("AD_LOADED"),this.debugService.debug(`The ad is starting, is linear? ${e.getAd().isLinear()}`),this.titleContainer!=null&&this.titleText!=null)if(this.mnAdvCountDown==null&&(this.mnAdvCountDown=d({elementType:"p",elementId:"mn-adv-countdown"}),this.titleContainer.insertBefore(this.mnAdvCountDown,this.titleText)),this.remainingTime=parseInt(this.adsManager.getRemainingTime()),this.debugService.debug(`Loaded a ${this.remainingTime} seconds ad`),this.remainingTime!=null&&this.remainingTime>0){if(typeof this.injectedTitleText=="string"){const n=this.injectedTitleText.split(" ").find(s=>!Number.isNaN(s));this.remainingTime=Math.max(Number(n),this.remainingTime)}this.mnAdvCountDown.innerHTML=`${this.adCountDownText} ${this.remainingTime}`}else this.debugService.debug(`AdsManager returns ${this.remainingTime} as the remaining time, skip count down!`);break}case window.google.ima.AdEvent.Type.PAUSED:{this.debugService.debug("The ad has been PAUSED"),this.outstreamAdvContainer?.classList.add("adv-paused");break}case window.google.ima.AdEvent.Type.RESUMED:{this.debugService.debug("The ad has been RESUMED"),this.outstreamAdvContainer?.classList.remove("adv-paused");break}case window.google.ima.AdEvent.Type.SKIPPED:{this.debugService.debug("The current ad has been SKIPPED"),this.mnAdvCountDown!=null&&(this.mnAdvCountDown.innerHTML="");break}case window.google.ima.AdEvent.Type.STARTED:{if(this.debugService.debug("The ad is STARDED"),this.emitEvent("AD_STARTED"),this.adStarted=!0,this.allAdCompleted=!1,this.videoContainerElement?.classList.add("mn-adv-started"),this.videoElement.paused||await D(this.videoElement,this.debugService),this.closeButton!=null){this.closeButton.classList.add("mn-status-hidden");const{showAfter:t}=this.playerConfig.closeButton;typeof t=="number"&&(this.debugService.debug(`Setting a timeout of ${t} seconds on ad_starded, before show the close button`),setTimeout(()=>{this.debugService.debug("The close button can be shown"),this.closeButton?.classList.remove("mn-status-hidden")},t*1e3))}!this.isPlayerInslide&&!this.playerConfig.canIncontentGoInslide&&!this.isPlayerVisible?(this.debugService.debug("The player is incontent, not visible and can NOT go inslide, pause the current ad"),this.adsManager.pause()):this.showOutstreamPlayer(),this.debugService.debug("Show ad container"),this.outstreamAdvContainer?.classList.remove("mn-status-hidden"),this.playerConfig.adControlsEnabled&&Ie({adContainer:this.outstreamAdvContainer,adDefaultVolume:this.playerConfig.adDefaultVolume,adsManager:this.adsManager,adsManagerResize:this.adsManagerResize.bind(this),closeAd:this.closeAd.bind(this),closeButtonConfig:this.playerConfig.closeAdvButton,debugService:this.debugService,emitEvent:this.emitEvent.bind(this),isDesktop:_,onContentResumeRequested:this.onContentResumeRequested.bind(this),videoContainerElement:this.videoContainerElement}),this.mnAdvCountDown!=null&&(this.titleText?.classList.add("mn-hidden-text-overflow"),this.injectedTitleText?.remove(),this.injectedTitleContainer?.remove(),clearInterval(this.adCountDownTimer),this.adCountDownTimer=setInterval(()=>{this.remainingTime=parseInt(this.adsManager.getRemainingTime()),this.mnAdvCountDown&&(this.mnAdvCountDown.innerHTML=`${this.adCountDownText} ${this.remainingTime}`),this.remainingTime<=0&&(clearInterval(this.adCountDownTimer),this.mnAdvCountDown&&(this.mnAdvCountDown.innerHTML=""),this.titleText?.classList.remove("mn-hidden-text-overflow"))},1e3));break}}}onAdsManagerLoaded(e){this.debugService.debug("onAdsManagerLoaded");const t=new window.google.ima.AdsRenderingSettings;t.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.adsManager=e.getAdsManager(this.videoElement,t),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAdEvent.bind(this)),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent.bind(this)),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this)),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this)),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.IMPRESSION,this.onAdEvent.bind(this)),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.LOADED,this.onAdEvent.bind(this)),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.PAUSED,this.onAdEvent.bind(this)),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.RESUMED,this.onAdEvent.bind(this)),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.SKIPPED,this.onAdEvent.bind(this)),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent.bind(this)),this.adsManager.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.playAds()}onImaScriptReady({callback:e}){if(typeof window.google<"u"&&typeof window.google.ima<"u"){this.debugService.debug("IMA sdk is already defined, immediately execute callback"),e();return}this.debugService.debug("IMA sdk is NOT defined, push callback in the queue"),this.onImaReadyQueue.push(e);let t=!1;const n=(function(){if(t){this.debugService.debug("The IMA queue has already been executed");return}this.onImaReadyQueue.length>0&&(this.debugService.debug("Execute the IMA queue"),t=!0,this.onImaReadyQueue.shift()())}).bind(this),o=document.querySelector('script[src="https://imasdk.googleapis.com/js/sdkloader/ima3.js"]');if(o!=null){this.debugService.debug("IMA script found"),o.onload=()=>{this.debugService.debug("Call executeImaQueue inside the script onload"),n()};const r=setInterval(()=>{typeof window.google<"u"&&typeof window.google.ima<"u"&&(this.debugService.debug("Call executeImaQueue inside the polling check"),clearInterval(r),n())},1e3)}}playAds(){this.debugService.debug("Initialize the adDisplayContainer"),this.adDisplayContainer.initialize(),this.adWillPlayMuted?(this.debugService.debug("The adv will play muted, set the adsManager volume to 0"),this.adsManager.setVolume(0)):(this.debugService.debug("The adv will not play muted and can start with sound, set the adsManager volume"),this.adsManager.setVolume(this.playerConfig.adDefaultVolume));try{this.debugService.debug("Outstream container sizes",this.videoContainerElement?.clientWidth,this.videoContainerElement?.clientHeight),this.adsManager.init(this.videoContainerElement?.clientWidth,this.videoContainerElement?.clientHeight,window.google.ima.ViewMode.NORMAL),this.adsManager.start()}catch(e){this.debugService.debug("Ads manager error",e)}}requestAds(){const e=new window.google.ima.AdsRequest;e.adTagUrl=this.adTagUrl,this.debugService.debug(`Adv will auto play: ${this.adWillAutoPlay}`),e.setAdWillAutoPlay(this.adWillAutoPlay),this.debugService.debug(`Adv will play muted: ${this.adWillPlayMuted}`),e.setAdWillPlayMuted(this.adWillPlayMuted),e.linearAdSlotWidth=640,e.linearAdSlotHeight=480,e.vastLoadTimeout=8e3,e.nonLinearAdSlotWidth=640,e.nonLinearAdSlotHeight=150,this.debugService.debug("Requesting ads",e),this.adsLoader.requestAds(e)}setUpIMA({adTagUrl:e,refreshed:t=!1}){if(this.debugService.debug("Setup Ima sdk with the new service"),this.adTagUrl=e,this.outstreamAdvContainer==null&&(this.debugService.debug("Adv container not found, creating one"),this.outstreamAdvContainer=d({elementType:"div",elementId:"mn-adv-container",className:"mn-status-hidden"}),this.outstreamAdvContainer.setAttribute("tabindex","0"),this.videoContainerElement?.appendChild(this.outstreamAdvContainer)),window.google.ima.settings.setDisableCustomPlaybackForIOS10Plus(!0),window.google.ima.settings.setVpaidMode(window.google.ima.ImaSdkSettings.VpaidMode.ENABLED),window.google.ima.settings.setLocale("it"),window.google.ima.settings.setNumRedirects(Re),this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.outstreamAdvContainer,this.videoElement),this.adsLoader=new window.google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setAutoPlayAdBreaks(!0),this.adsLoader.addEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1),this.adsLoader.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this)),this.videoElement.onended=()=>{try{this.adsLoader.contentComplete()}catch(n){this.debugService.debug(n)}},t){this.debugService.debug("The adv request has been refreshed"),this.handleAdvRequest();return}if(this.isPlayerInslide){this.debugService.debug("The player behavior is inslide, start handleAdvRequest"),this.handleAdvRequest();return}this.playerConfig.startAdClickToPlay&&(this.debugService.debug("The adv should start only after a user interaction with the player"),this.detectUserInteraction())}}class j{console=window.console;isDebugEnabled=!1;static debugStyle="display:inline-block; color:white; background:black; border-radius:3px;";static warnStyle="display:inline-block; color:white; background:goldenrod; border-radius:3px;";static errorStyle="display:inline-block; color:white; background:red; border-radius:3px;";constructor({isDebug:e}){e&&(this.isDebugEnabled=!0)}debug(e,...t){this.isDebugEnabled&&this.console.debug("%c MN-Player ",j.debugStyle,e,...t)}warn(e,...t){this.isDebugEnabled&&this.console.warn("%c MN-Player ",j.warnStyle,e,...t)}error(e,...t){this.console.trace("%c MN-Player ",j.errorStyle,e,...t)}}ae.injectImaScript();class Ve{closeButton;debugService;events;injectedBannerContainer;injectedTitleContainer;injectedTitleText;isAdCycleEnded;isAdvRequestWithObserverStart;isDebugEnabled;isExternalInjectionRunning;isPlayerInslide;isPlayerVisible;isVideoAutoPlayEnabled;mnAdLibrary;mnPlayerWrapper;outstreamContainer;playerConfig;playerControls;playerEventManager;sourceForAutoPlayCheckOrVip;titleContainer;titleText;videoContainerElement;videoElement;constructor({adControlsEnabled:e=!0,adDefaultVolume:t=.01,adTagUrl:n,appendTo:s="#mn-container",autoPlay:o=!1,behavior:r="incontent",canIncontentGoInslide:l=!0,closeAdvButton:{advButtonEnabled:a=!1,advButtonPosition:p="left",advButtonShowAfter:g=15,advButtonText:u}={},closeButton:{enabled:c=!0,enableOnBannerInjection:m=!1,position:f="top-right",showAfter:L=15,showAfterAdComplete:v=!1,showAfterAdCompleteDelay:T,text:k="X"}={},controls:A=!0,enableContinuousVideoPlayback:h=!1,hlsEsmLibraryUrl:b,hlsLibraryUrl:E,onPlayerReady:C,playerPosition:w="right",poster:x,source:H,startAdClickToPlay:V=!1,startAdInView:Oe=!1,startAdWithVolume:je=!1,startVideoContentWithVolume:He=!1,style:Be,subtitles:{defaultSubtitle:qe="Off",enableSubtitles:We=!1,subtitleTrackList:$e}={},videoAutoPlay:_e=!1,videoContentTitle:ze,videoDescription:{enableVideoDescription:Ne=!1,videoAdCountDownText:Fe,videoDescriptionText:Ue}={},videoVolume:Qe=.1}={}){window.mnPlayerWebsiteApi={version:"[master]-[29-10-2026_15:22:59]"},this.events={},this.isAdCycleEnded=!1,this.isAdvRequestWithObserverStart=!1,this.isDebugEnabled=!1,this.isExternalInjectionRunning=!1,this.isPlayerVisible=!1,this.sourceForAutoPlayCheckOrVip="https://pull-zone-pubtech.b-cdn.net/sample_video_ads.mp4",(ye("debug_player")||O("debug_player"))&&(this.isDebugEnabled=!0),this.debugService=new j({isDebug:this.isDebugEnabled});const Ke="https://ads.talkscreativity.com/assets/product/mn-player-deps/hls.min.1.6.15.js",Ge="https://ads.talkscreativity.com/assets/product/mn-player-deps/hls.1.6.15.mjs";if(this.playerConfig={adControlsEnabled:e,adDefaultVolume:t,adTagUrl:n,appendTo:s,autoPlay:o,behavior:r,canIncontentGoInslide:l,closeAdvButton:{advButtonEnabled:a,advButtonPosition:p,advButtonShowAfter:g,advButtonText:u},closeButton:{enabled:c,enableOnBannerInjection:m,position:f,showAfter:L,showAfterAdComplete:v,showAfterAdCompleteDelay:T,text:k},controls:A,enableContinuousVideoPlayback:h,hlsEsmLibraryUrl:b||Ge,hlsLibraryUrl:E||Ke,onPlayerReady:C,playerPosition:w,poster:x,source:H,startAdClickToPlay:V,startAdInView:Oe,startAdWithVolume:je,startVideoContentWithVolume:He,style:Be,subtitles:{defaultSubtitle:qe,enableSubtitles:We,subtitleTrackList:$e},videoAutoPlay:_e,videoContentTitle:ze,videoDescription:{enableVideoDescription:Ne,videoAdCountDownText:Fe,videoDescriptionText:Ue},videoVolume:Qe},Array.isArray(window._mnPlayerConfig)&&window._mnPlayerConfig.length>0&&Object.assign(this.playerConfig,...window._mnPlayerConfig),this.debugService.debug("MnPlayer config:",this.playerConfig),this.isPlayerInslide=this.playerConfig.behavior==="inslide",this.isVideoAutoPlayEnabled=this.playerConfig.videoAutoPlay,this.mnPlayerWrapper=document.querySelector(this.playerConfig.appendTo),!this.isPlayerInslide&&this.mnPlayerWrapper==null){this.debugService.error("The container where the player should be appended is not on the page");return}this.isDebugEnabled&&(O("debug_single_adv")?this.playerConfig.adTagUrl="https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/single_preroll_skippable&sz=640x480&ciu_szs=300x250%2C728x90&gdfp_req=1&output=vast&unviewed_position_start=1&env=vp&impl=s&correlator=":O("debug_adv")&&(this.playerConfig.adTagUrl="https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/vmap_ad_samples&sz=640x480&cust_params=sample_ar%3Dpremidpostpodbumper&ciu_szs=300x250&gdfp_req=1&ad_rule=1&output=vmap&unviewed_position_start=1&env=vp&impl=s&cmsid=496&vid=short_onecue&correlator="),O("debug_mp4")?this.playerConfig.source="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4":O("debug_m3u8")&&(this.playerConfig.source="https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8")),this.mnAdLibrary=new ae({adCountDownText:this.playerConfig.videoDescription.videoAdCountDownText,debugService:this.debugService,emitEvent:this.emit.bind(this),isPlayerInslide:this.isPlayerInslide,onContentPauseRequested:this.onContentPauseRequested.bind(this),onContentResumeRequested:this.onContentResumeRequested.bind(this),playerConfig:this.playerConfig,showOutstreamPlayer:this.showOutstreamPlayer.bind(this),sourceForAutoPlayCheck:this.sourceForAutoPlayCheckOrVip}),this.initOutstreamPlayer().then(()=>{typeof this.playerConfig.onPlayerReady=="function"&&(this.playerEventManager={on:(Z,Xe)=>{this.events[Z]==null&&(this.events[Z]=[]),this.events[Z].push(Xe)}},this.playerConfig.onPlayerReady(this.playerEventManager)),this.mnAdLibrary.onImaScriptReady({callback:(function(){this.debugService.debug("Call startAdvLibrary from onImaScriptReady callback"),this.startAdvLibrary()}).bind(this)})})}async initOutstreamPlayer(){if(this.outstreamContainer=d({elementId:"mn-outstream-container"}),this.outstreamContainer.setAttribute("tabindex","0"),this.videoContainerElement=d({elementId:"mn-video-player-container"}),this.videoContainerElement.setAttribute("tabindex","0"),this.videoElement=d({elementType:"video",elementId:"mn-outstream-video-player"}),this.videoElement.setAttribute("tabindex","0"),this.videoElement.setAttribute("webkit-playsinline","true"),this.videoElement.playsInline=!0,this.videoElement.disableRemotePlayback=!0,this.videoElement.preload="none",this.videoElement.disablePictureInPicture=!0,this.videoElement.muted=!this.playerConfig.startVideoContentWithVolume,this.videoElement.volume=this.playerConfig.startVideoContentWithVolume?this.playerConfig.videoVolume:0,this.playerConfig.poster!=null&&(this.videoElement.poster=this.playerConfig.poster),this.playerConfig.style!=null)for(const t in this.playerConfig.style)this.outstreamContainer.style.setProperty(`--player-${t}`,this.playerConfig.style[t]);this.videoElement.addEventListener("contextmenu",t=>t.preventDefault());const e=ke({debugService:this.debugService,hlsLibraryUrl:this.playerConfig.hlsLibraryUrl,hlsEsmLibraryUrl:this.playerConfig.hlsEsmLibraryUrl,source:this.playerConfig.source,subtitles:this.playerConfig.subtitles,vipSource:this.sourceForAutoPlayCheckOrVip,videoElement:this.videoElement});this.playerConfig.controls&&(this.playerControls=Ee({adsManagerResize:()=>this.mnAdLibrary.adsManagerResize(),debugService:this.debugService,isAdTagUrlDefined:this.playerConfig.adTagUrl!=null,isDesktop:_,isMobile:fe,subtitles:this.playerConfig.subtitles,toggleVideoAutoPlay:this.toggleVideoAutoPlay.bind(this),videoContainerElement:this.videoContainerElement,videoElement:this.videoElement})),Te({playerControls:this.playerControls,videoContentTitle:this.playerConfig.videoContentTitle,videoElement:this.videoElement}),this.videoContainerElement.appendChild(this.videoElement),this.outstreamContainer.appendChild(this.videoContainerElement),this.playerConfig.videoDescription.enableVideoDescription&&(this.titleContainer=d({elementId:"mn-title-container"}),this.titleText=d({elementType:"p",elementId:"mn-title-text"}),this.titleText.innerHTML=this.playerConfig.videoDescription.videoDescriptionText,this.titleContainer.appendChild(this.titleText),this.outstreamContainer.appendChild(this.titleContainer)),this.playerConfig.closeButton.enabled&&(this.closeButton=xe({closeButtonConfig:this.playerConfig.closeButton,closePlayer:this.closePlayer.bind(this),debugService:this.debugService,outstreamContainer:this.outstreamContainer})),this.injectCSSStyle(),this.isPlayerInslide?(this.outstreamContainer.classList.add("mn-inslide"),this.playerConfig.source!=null&&this.playerConfig.videoAutoPlay?this.outstreamContainer.classList.add(`mn-position-${this.playerConfig.playerPosition}`):this.outstreamContainer.classList.add(`mn-offscreen-${this.playerConfig.playerPosition}`),document.body.appendChild(this.outstreamContainer)):(this.outstreamContainer.classList.add("mn-incontent"),this.mnPlayerWrapper.clientWidth<=300&&this.outstreamContainer.classList.add("mn-small-incontent-type"),this.setVideoElementHeight(),this.setUpObserver(),this.mnPlayerWrapper.appendChild(this.outstreamContainer)),this.mnAdLibrary.getMnPlayerElements({closeButton:this.closeButton,outstreamContainer:this.outstreamContainer,titleContainer:this.titleContainer,titleText:this.titleText,videoContainerElement:this.videoContainerElement,videoElement:this.videoElement}),this.isVideoAutoPlayEnabled&&this.videoElement.paused&&e.then(()=>{P(this.videoElement).then(()=>this.debugService.debug("Starting video content")).catch(t=>this.debugService.warn("Error while starting video content",t))}),this.outstreamContainer.addEventListener("keydown",t=>{Me({adsManagerResize:()=>this.mnAdLibrary.adsManagerResize(),closeButton:this.closeButton,debugService:this.debugService,event:t,outstreamContainer:this.outstreamContainer,playerContainer:this.outstreamContainer,playerControls:this.playerControls,videoContainer:this.videoContainerElement,videoElement:this.videoElement})}),await y(),this.emit("PLAYER_READY")}emit(e,...t){this.events[e]&&this.events[e].forEach(n=>{n(...t)})}removeVideoElementInlineStyle(){this.videoElement.removeAttribute("style")}setVideoElementHeight(){const e=this.mnPlayerWrapper?.clientWidth??0;this.videoElement.style.height=`calc((${e}px / 16) * 9)`}keepPlayerWrapperHeight(){this.mnPlayerWrapper==null||!this.outstreamContainer.classList.contains("mn-incontent")||(this.mnPlayerWrapper.style.minHeight=`${this.outstreamContainer.offsetHeight}px`)}releasePlayerWrapperHeight(){this.mnPlayerWrapper?.style.removeProperty("min-height")}restoreIncontentPosition(){this.outstreamContainer.classList.add("mn-incontent"),this.outstreamContainer.classList.remove("mn-inslide"),this.setVideoElementHeight(),this.releasePlayerWrapperHeight()}removePlayer(){this.outstreamContainer.remove(),this.releasePlayerWrapperHeight()}closePlayer(){this.debugService.debug("The player has been closed by the user"),this.mnAdLibrary.closeAd(),this.videoContainerElement.classList.remove("mn-adv-started"),this.videoElement.paused||D(this.videoElement,this.debugService),this.isPlayerInslide?this.isAdCycleEnded?(this.debugService.debug("The ad cycle has already ended, remove the player"),this.removePlayer()):(this.outstreamContainer.classList.add(`mn-offscreen-${this.playerConfig.playerPosition}`),this.outstreamContainer.classList.remove(`mn-position-${this.playerConfig.playerPosition}`)):this.restoreIncontentPosition(),this.emit("PLAYER_CLOSED",{})}toggleVideoAutoPlay(){this.isVideoAutoPlayEnabled=!this.isVideoAutoPlayEnabled,this.debugService.debug(`Set isVideoAutoPlayEnabled to ${this.isVideoAutoPlayEnabled}`)}startAdvLibrary(e=null,t=!1){this.debugService.debug("Starting adv library");const n=e??this.playerConfig.adTagUrl;this.mnAdLibrary.setUpIMA({adTagUrl:n,refreshed:t})}setUpObserver(){const e=new IntersectionObserver(t=>{t.forEach(n=>{this.isPlayerVisible=n.isIntersecting,this.mnAdLibrary.getPlayerVisibility(this.isPlayerVisible),this.isPlayerVisible?(this.debugService.debug("The player become visible"),this.mnAdLibrary.isAdStarted&&!this.mnAdLibrary.areAllAdCompleted?this.playerConfig.canIncontentGoInslide||(this.debugService.debug("The player did NOT go inslide, resume the adv"),this.mnAdLibrary.adsManagerResume()):this.isVideoAutoPlayEnabled&&this.videoElement.paused&&P(this.videoElement).then(()=>this.debugService.debug("Starting video content")).catch(s=>this.debugService.warn("Error while starting video content",s)),!this.isAdvRequestWithObserverStart&&!this.playerConfig.startAdClickToPlay&&(this.isAdvRequestWithObserverStart=!0,this.mnAdLibrary.handleAdvRequest()),this.outstreamContainer.classList.contains("mn-inslide")&&(this.debugService.debug("The player position is back in view, restore it"),this.restoreIncontentPosition(),this.mnAdLibrary.adsManagerResize({height:this.videoContainerElement.clientHeight,width:this.videoContainerElement.clientWidth}))):(this.debugService.debug("The player is not visible"),this.playerConfig.enableContinuousVideoPlayback||this.videoElement.pause(),this.playerControls?.controlsContainer.classList.add("visible"),this.playerControls?.playButton.classList.add("visible"),!this.isAdvRequestWithObserverStart&&!this.playerConfig.startAdInView&&!this.playerConfig.startAdClickToPlay&&(this.debugService.debug("The adv request can start even if the player is not visible"),this.isAdvRequestWithObserverStart=!0,this.mnAdLibrary.handleAdvRequest()),this.mnAdLibrary.isAdStarted&&!this.mnAdLibrary.areAllAdCompleted&&(this.debugService.debug("The adv is started but not yet completed"),this.playerConfig.canIncontentGoInslide?(this.debugService.debug("The player can go inslide, call showOutstreamPlayer"),this.showOutstreamPlayer()):(this.debugService.debug("The player can NOT go inslide, the adv is paused"),this.mnAdLibrary.adsManagerPause())))})});this.mnPlayerWrapper&&e.observe(this.mnPlayerWrapper)}showOutstreamPlayer(){if(this.isPlayerInslide){this.debugService.debug(`Show the player inslide with position ${this.playerConfig.playerPosition}`),this.outstreamContainer.classList.add(`mn-position-${this.playerConfig.playerPosition}`),this.outstreamContainer.classList.remove(`mn-offscreen-${this.playerConfig.playerPosition}`);return}this.isPlayerVisible||(this.debugService.debug(`The player is incontent and not in view, show the player in inslide mode at ${this.playerConfig.playerPosition} position`),this.keepPlayerWrapperHeight(),this.outstreamContainer.classList.add("mn-inslide",`mn-position-${this.playerConfig.playerPosition}`),this.outstreamContainer.classList.remove("mn-incontent",`mn-offscreen-${this.playerConfig.playerPosition}`),this.removeVideoElementInlineStyle(),this.mnAdLibrary.adsManagerResize({height:this.videoContainerElement.clientHeight,width:this.videoContainerElement.clientWidth}))}handleVideoContentResume(){this.debugService.debug("Resuming video content"),this.isAdCycleEnded=!0,this.mnAdLibrary.destroyTestVideoElement();const e=this.outstreamContainer.classList.contains(`mn-offscreen-${this.playerConfig.playerPosition}`);if(this.isPlayerInslide&&(this.playerConfig.source==null||e)){this.debugService.debug("Destroying outstream player"),this.outstreamContainer.remove();return}this.mnAdLibrary.destroyAdContainer(),this.isVideoAutoPlayEnabled&&this.videoElement.paused&&(this.isPlayerInslide||this.isPlayerVisible)&&P(this.videoElement).then(()=>this.debugService.debug("Starting video content")).catch(t=>this.debugService.warn("Error while starting video content",t))}onContentPauseRequested(){this.debugService.debug("onContentPauseRequested: pause player"),D(this.videoElement,this.debugService)}onContentResumeRequested(){this.debugService.debug("onContentResumeRequested: request to resume content"),this.mnAdLibrary.hideAdContainer(),this.videoContainerElement.classList.remove("mn-adv-started"),this.videoContainerElement.classList.add("mn-content-resume"),this.videoContainerElement.classList.contains("mn-video-started")&&this.playerControls?.fullScreenButton.classList.remove("mn-status-hidden"),!this.isExternalInjectionRunning&&this.isVideoAutoPlayEnabled&&this.videoElement.paused&&P(this.videoElement).then(()=>this.debugService.debug("Starting video content")).catch(e=>this.debugService.warn("Error while starting video content",e))}createContainerForExternalInjection({elementToInject:e}){if(e==null){this.debugService.debug("The element to inject is null, skip container injection!");return}this.debugService.debug("Element injection starting.."),this.isExternalInjectionRunning=!0,this.mnAdLibrary.isExternalInjectionActive(this.isExternalInjectionRunning),this.injectedBannerContainer=d({elementId:"mn-injected-container"}),this.injectedBannerContainer.appendChild(e),this.videoContainerElement.appendChild(this.injectedBannerContainer)}setupPlayerUIForExternalInjection({enableVideoTitle:e,injectedElementViewTime:t,websiteDomain:n}){if(this.videoElement.paused||D(this.videoElement,this.debugService),this.isVideoAutoPlayEnabled=!1,this.isPlayerInslide||(this.keepPlayerWrapperHeight(),this.removeVideoElementInlineStyle()),this.outstreamContainer.classList.add("mn-inslide",`mn-position-${this.playerConfig.playerPosition}`),this.outstreamContainer.classList.remove("mn-incontent",`mn-offscreen-${this.playerConfig.playerPosition}`),this.injectedBannerContainer?.classList.add("slot-render-ended"),this.playerControls?.controlsContainer.classList.add("mn-status-hidden"),this.playerControls?.playButton.classList.add("mn-status-hidden"),this.closeButton!=null){this.closeButton.classList.add("mn-status-hidden");const{enableOnBannerInjection:s,showAfter:o}=this.playerConfig.closeButton;s&&(this.debugService.debug("The close button is enabled during banner injection"),setTimeout(()=>{this.debugService.debug("The close button can be shown"),this.closeButton?.classList.remove("mn-status-hidden")},o*1e3))}if(e){this.injectedTitleText=d({elementType:"p",elementId:"mn-injected-title-text"});let s=t;const o=n!=null?n.split(".").shift():"";this.injectedTitleText.innerHTML=`Video ${o} tra ${s}`,this.titleContainer!=null&&this.titleText!=null?this.titleContainer.insertBefore(this.injectedTitleText,this.titleText):(this.injectedTitleContainer=d({elementId:"mn-injected-title-container"}),this.injectedTitleContainer.appendChild(this.injectedTitleText),this.outstreamContainer.appendChild(this.injectedTitleContainer)),this.mnAdLibrary.getMnPlayerInjectedElements({injectedTitleContainer:this.injectedTitleContainer,injectedTitleText:this.injectedTitleText});const r=setInterval(()=>{s=s-1,this.injectedTitleText.innerHTML=`Video ${o} tra ${s}`,s<=0&&clearInterval(r)},1e3)}}removeExternalInjectionUI(){this.debugService.debug("Removing external injection UI"),this.isPlayerInslide?this.playerConfig.source==null&&(this.debugService.debug("The source is null, hide outstream container"),this.outstreamContainer.classList.add(`mn-offscreen-${this.playerConfig.playerPosition}`),this.outstreamContainer.classList.remove(`mn-position-${this.playerConfig.playerPosition}`)):this.playerConfig.videoAutoPlay&&P(this.videoElement).then(()=>{this.debugService.debug("Starting video content"),this.isVideoAutoPlayEnabled=!0}).catch(e=>this.debugService.warn("Error while starting video content",e)),this.injectedTitleText?.remove(),this.injectedTitleContainer?.remove(),this.injectedBannerContainer?.remove(),this.playerControls?.controlsContainer.classList.remove("mn-status-hidden"),this.playerControls?.playButton.classList.remove("mn-status-hidden"),this.closeButton?.classList.remove("mn-status-hidden"),this.isExternalInjectionRunning=!1,this.mnAdLibrary.isExternalInjectionActive(this.isExternalInjectionRunning)}injectCSSStyle(){const e=document.createElement("style");e.appendChild(document.createTextNode(le)),document.head.appendChild(e)}}window.loadMnPlayer=i=>new Ve(i),Ce()})();