(()=>{if(window.embiInterstitialLoaded)return void console.warn("EMBI Interstitial script ya estΓ‘ cargado. Abortando ejecuciΓ³n duplicada.");window.embiInterstitialLoaded=!0;const e=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)<=768,t=[];function o(e){try{return document.querySelector(e)}catch(e){return console.error("Error getting element",e),null}}!function(e,t){if(!document.querySelector(`script[src='${e}']`)){const o=document.createElement("script");o.async=t,o.type="text/javascript",o.src=e,document.head.appendChild(o)}}("https://securepubads.g.doubleclick.net/tag/js/gpt.js",!1);var n=window.googletag=window.googletag||{};n.cmd=n.cmd||[],n.cmd.push(function(){t.filter(e=>"TABOOLA_INTEGRATION"!==e.type).forEach(t=>{try{const o=e?t.mobileSizes:t.desktopSizes;t.adSlot=n.defineSlot(t.slot,o,t.tagId).setForceSafeFrame(!1).addService(n.pubads()),"DOUBLE_BOX"===t.type&&(t.adSlotB=n.defineSlot(t.slot2,o,t.tagId2).setForceSafeFrame(!1).addService(n.pubads()))}catch(e){console.warn("Error creating GPT slot for product",t.tagId,e)}}),n.pubads().enableSingleRequest(),n.pubads().enableLazyLoad({fetchMarginPercent:200,renderMarginPercent:100,mobileScaling:1}),n.pubads().collapseEmptyDivs(!0),n.pubads().setCentering(!0),n.enableServices(),t.map(t=>{!function(t){try{if(t.manualInsertion&&"TABOOLA_INTEGRATION"!==t.type){const e=t.tagId;new MutationObserver((t,o)=>{document.getElementById(e)&&(n.cmd.push(function(){n.display(e)}),o.disconnect())}).observe(document.body,{childList:!0,subtree:!0})}else{const r=t.type,a=t.position,s=t.ubication,d=t.tagId,l=t.offset;try{if("TABOOLA_INTEGRATION"===r)createTaboolaContainer(t);else if("HIGH_IMPACT"===r)INTERSTITIAL_CONTAINER=createInterstitialContainer(d);else if("DISPLAY_VIDEO_STICKY"===r)cornerContainer=createCornerContainer(d,a,l);else if("FOOTER_INTOP"===r)footerInTopContainer=createfooterInTopContainer(d,a);else if("DOUBLE_BOX"===r){const n=o(`${s}`);if(!n)return console.error(`Elemento con clase '${s}' no encontrado en el DOM para el anuncio ${d}. No se pudo insertar el DIV.`),!1;const r=t.tagId2,l=document.createElement("div");l.id=`container_${d}`,(i=l).style.display="flex",i.style.flexDirection=e?"column":"row",i.style.gap="24px",i.style.marginBottom="24px",i.style.background="transparent",i.style.justifyContent="center";const c=document.createElement("div");c.id=d,l.appendChild(c);const u=document.createElement("script");u.textContent=`\n googletag.cmd.push(function() {\n googletag.display('${d}');\n });\n `,c.appendChild(u);const p=document.createElement("div");p.id=r,l.appendChild(p);const m=document.createElement("script");switch(m.textContent=`\n googletag.cmd.push(function() {\n googletag.display('${r}');\n });\n `,p.appendChild(m),a){case"INSERT_BEFORE":n.insertAdjacentElement("beforebegin",l);break;case"INSERT_AFTER":n.insertAdjacentElement("afterend",l);break;default:n.appendChild(l)}}else if("DISPLAY_VIDEO"===r){const e=o(`${s}`);if(!e)return void console.error(`Elemento con clase '${s}' no encontrado en el DOM para el anuncio ${d}.`);const t=document.createElement("div");switch(t.id=d,t.style.marginBottom="24px",addDisplayScript(t,d),a){case"INSERT_BEFORE":e.insertAdjacentElement("beforebegin",t);break;case"INSERT_AFTER":e.insertAdjacentElement("afterend",t);break;default:e.appendChild(t)}}else if(t.isSticky)cornerContainer=createCornerContainer(d,a),addDisplayScript(cornerContainer,d);else{const e=o(`${s}`);if(!e)return void console.error(`Elemento con clase '${s}' no encontrado en el DOM para el anuncio ${d}.`);const t=document.createElement("div");switch(t.id=d,t.style.marginBottom="24px",addDisplayScript(t,d),a){case"INSERT_BEFORE":e.insertAdjacentElement("beforebegin",t);break;case"INSERT_AFTER":e.insertAdjacentElement("afterend",t);break;default:e.appendChild(t)}}setInterval(function(){if(t.adSlot){if("HIGH_IMPACT"===t.type&&isIntertitialAdShown)return;n.pubads().refresh([t.adSlot])}t.adSlotB&&n.pubads().refresh([t.adSlotB])},3e4)}catch(e){console.error(`Error procesando el anuncio ${d}:`,e)}}}catch(e){console.warn("Error rendering adunit for product",t.tagId,e)}var i}(t)})})})(),function(){"use strict";const e={adSlotId:"18251",vidvertoId:"18251_vidverto",width:"90vw",maxWidth:"340px",aspectRatio:"16 / 9",position:"BOTTOM_LEFT",offsetX:0,offsetY:0,mobileOffsetX:0,mobileOffsetY:-100,mobileBreakpoint:768,useAbsolutePosition:!1,zIndex:"9997",borderRadius:"12px",backgroundColor:"#000",boxShadow:"0 4px 12px rgba(0,0,0,0.3)",closeButtonColor:"rgba(0, 0, 0, 0.6)",closeButtonHoverColor:"rgba(0, 0, 0, 0.8)",animationDuration:"0.3s",showCloseButton:!0,autoShow:!0,retryAttempts:20,retryDelay:200,dimensionMonitorDuration:1e4,dimensionCheckInterval:100,debug:!1};function t(t,...o){if(e.debug)switch(t){case"log":default:console.log(...o);break;case"warn":console.warn(...o);break;case"error":console.error(...o);break;case"info":console.info(...o)}}const o={TOP_LEFT:{top:"20px",left:"20px",bottom:"auto",right:"auto"},TOP_RIGHT:{top:"20px",right:"20px",bottom:"auto",left:"auto"},BOTTOM_LEFT:{bottom:"20px",left:"20px",top:"auto",right:"auto"},BOTTOM_RIGHT:{bottom:"20px",right:"20px",top:"auto",left:"auto"}};let n,i,r,a,s,d=!1,l=null,c=null,u=null,p=0,m=new Set,f=!1,g=!1;function h(e){const n={...o[e.position]},i=function(e){return window.innerWidth{!function(){if(!n)return;const t=h(e);Object.assign(n.style,t)}()},150)}function y(e){if(!e.showCloseButton)return;const o=document.createElement("button");o.innerHTML="Γ—",o.title="Close video";const l={position:"absolute",top:"-20px",right:"0px",width:"16px",height:"16px",background:e.closeButtonColor,opacity:"0.2",padding:"0px",border:"none",borderRadius:"50%",color:"#fff",fontSize:"18px",fontWeight:"bold",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"10001",transition:"background 0.2s ease, transform 0.2s ease",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"};Object.assign(o.style,l),o.addEventListener("mouseenter",()=>{o.style.background=e.closeButtonHoverColor,o.style.transform="scale(1.1)",o.style.boxShadow="0 4px 12px rgba(0,0,0,0.4)"}),o.addEventListener("mouseleave",()=>{o.style.background=e.closeButtonColor,o.style.transform="scale(1)",o.style.boxShadow="0 2px 8px rgba(0,0,0,0.3)"}),o.addEventListener("click",()=>{n&&n.parentNode&&(r&&(r.disconnect(),r=null),a&&(a.disconnect(),a=null),w(),window.removeEventListener("resize",v),clearTimeout(s),n.parentNode.removeChild(n),n=null,i=null,d=!1,u=null,g=!1,f=!1,m.clear(),p=0,t("log","βœ… Floating video container completely removed"))}),n.appendChild(o)}function b(){if(!i)return!1;const o=i.querySelectorAll("div.aries_videoWrapper > div.aries_videoPlayer > div > div");let n=!1;return o.length>0&&o.forEach((o,i)=>{const r=o.id||o.outerHTML.slice(0,50),a=m.has(r),s=""!==o.style.width||""!==o.style.height;if(!a||s){t("log",`πŸ”§ Mutation: Video ${i+1}: ${a?"Dimensions reapplied":"Found new element"}, removing dimensions...`),o.style.setProperty("width","","important"),o.style.setProperty("height","","important"),o.style.setProperty("max-width","100%","important"),o.style.setProperty("max-height","100%","important");o.querySelectorAll("iframe").forEach(t=>{t.style.setProperty("max-width",e.maxWidth,"important"),t.style.setProperty("max-height",e.maxHeight,"important"),t.style.setProperty("width","100%","important"),t.style.setProperty("height","100%","important"),t.removeAttribute("width"),t.removeAttribute("height")}),m.add(r),u=o,t("log",`βœ… Mutation: Video ${i+1}: Removed/prevented width and height from:`,o),n=!0}}),n}function w(){l&&(clearInterval(l),l=null),c&&(clearTimeout(c),c=null),a&&(a.disconnect(),a=null,t("log","πŸ”Œ Mutation observer disconnected")),f=!1,t("log","⏹️ Dimension monitoring stopped")}function x(){if(g)return void t("log","⚠️ Styles already applied, skipping...");g=!0,t("log","🎨 Applying all styles after video load...");const o=i.querySelector(`div[id^="${e.vidvertoId}"]`);o&&Object.assign(o.style,{width:"100%",height:"100%",position:"absolute",top:"0",left:"0"}),T(),S(),E(),function(){if(a)return;t("log","πŸ” Setting up dimension observer for all video elements..."),a=new MutationObserver(e=>{e.some(e=>"attributes"===e.type&&"style"===e.attributeName&&e.target.matches("div.aries_videoWrapper > div.aries_videoPlayer > div > div"))?(t("log","⚠️ Style attribute changed on video element(s), reapplying to all..."),b()):b()}),a.observe(i,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","id"]}),t("log","βœ… Dimension observer started for all video elements")}(),function(){if(f)return void t("log","⚠️ Dimension monitoring already active, skipping...");f=!0,t("log","πŸ” Starting continuous dimension monitoring...");let o=0;const n=e.dimensionMonitorDuration/e.dimensionCheckInterval;l=setInterval(()=>{if(o++,!i||!i.parentNode)return t("warn","Container removed, stopping dimension monitoring"),void w();o>=n&&w()},e.dimensionCheckInterval),c=setTimeout(()=>{w()},e.dimensionMonitorDuration),t("log",`βœ… Monitoring active for ${e.dimensionMonitorDuration/1e3} seconds`)}(),t("log","βœ… All styles applied and monitoring started")}function I(o=0){if(t("log",`Checking video loaded (attempt ${o+1}/${e.retryAttempts+1})`),function(){t("log","Checking if video/ad is loaded..."),t("log","Container:",i),t("log","CONFIG.ID:",e.vidvertoId);const o=i.querySelector(`div[id^="${e.vidvertoId}"]`),n=document.querySelector(`div[id*="_${e.adSlotId}_"]`);if(t("log","Dynamic div found:",o),!o)return!1;if(t("log","Video div found:",n),!n)return!1;const r=n.children.length>0;t("log","Has content:",r);const a=n.querySelector("video")||n.querySelector("iframe")||n.querySelector("canvas")||n.querySelector('[class*="video"]')||n.querySelector('[class*="player"]');t("log","Has video element:",a);const s=o.id!==e.vidvertoId,d=o.innerHTML.trim().length>0;return r&&(a||s&&d)}())return t("log","βœ… Video/ad detected as loaded, applying styles and showing container"),x(),n&&e.autoShow&&(n.style.display="block",n.offsetHeight,n.style.opacity="1",n.style.transform="translateY(0)"),!0;if(oI(o+1),n)}else t("warn","Video/ad not detected as loaded after maximum retries");return!1}function S(e=0,o=10){if(!i)return void t("warn","Container not available for aries div styling");const n=i.querySelectorAll('div[id^="aries_div_"]');if(0!==n.length)t("log",`🎯 Found ${n.length} aries div(s) inside floating wrapper to style`),n.forEach((e,o)=>{Object.assign(e.style,{width:"100%",height:"100%"}),t("log",`βœ… Styled aries div ${o+1}`)});else if(eS(e+1,o),t)}else t("warn","No aries divs found inside floating wrapper after maximum retries")}function E(o=0,n=10){if(!i)return void t("warn","Container not available for aries video player styling");const r=i.querySelectorAll('.aries_videoPlayer:not([class*=" "])');if(0!==r.length)t("log",`🎯 Found ${r.length} aries video player(s) inside floating wrapper to style`),r.forEach((o,n)=>{o.style.maxWidth=e.maxWidth,o.style.maxHeight=e.maxHeight,t("log",`βœ… Styled aries video player ${n+1}`)});else if(oE(o+1,n),e)}else t("warn","No aries video players found inside floating wrapper after maximum retries")}function T(o=0,n=15){if(!i)return void t("warn","Container not available for child styling");const r=i.querySelector(`div[id*="_${e.adSlotId}_"]`);if(r)return async function(){const o=[r];let n=r;for(let e=0;e<3;e++){const i=await a(n,e);if(!i){t("log",`Stopping at level ${e+1} - no more children found`);break}o.push(i),n=i}return t("log",`Total children found: ${o.length}`),o.forEach((t,o)=>{if(t){const n=3===o?{width:"100%",height:"100%",maxWidth:e.maxWidth,maxHeight:e.maxHeight}:{width:"100%",height:"100%"};Object.assign(t.style,n)}}),o.length}().then(e=>{if(0===e&&oT(o+1,n),e)}else e>0?t("log",`βœ… Successfully styled ${e} children`):t("warn","No children found after maximum retries")});if(oT(o+1,n),e)}else t("warn","First child not found inside floating wrapper after maximum retries");function a(e,t=0,o=3){return new Promise(t=>{!function o(n=0,i=5){const r=e.querySelector(":scope > div");if(r)return t(r);if(!(no(n+1,i),50+25*n)}()})}}function C(){t("log","πŸš€ Initializing Configurable Floating Video..."),"loading"!==document.readyState?(t("log","πŸ“‹ Using configuration:",e),function(e){n=document.createElement("div"),n.id="floating-video-wrapper";const o=h(e),r={position:"fixed",zIndex:e.zIndex,display:"none",opacity:"0",transform:"translateY(20px)",transition:`opacity ${e.animationDuration} ease, transform ${e.animationDuration} ease`,...o};Object.assign(n.style,r),i=document.createElement("div"),i.id="floating-video-container";const a={width:e.width,maxWidth:e.maxWidth,aspectRatio:e.aspectRatio,background:e.backgroundColor,borderRadius:e.borderRadius,overflow:"hidden",boxShadow:e.boxShadow,display:"flex",alignItems:"center",justifyContent:"center"};Object.assign(i.style,a),n.appendChild(i),document.body.appendChild(n),t("log","βœ… Floating video structure created with config:",e)}(e),y(e),window.addEventListener("resize",v),r=new MutationObserver(o=>{t("log","MutationObserver triggered, mutations:",o.length);const n=i.querySelector(`div[id^="${e.vidvertoId}"]`);if(!n)return void t("log","Skipping - no dynamic div found");if(d)return void t("log","Skipping - already processed dynamic div");const a=n.children.length>0||""!==n.innerHTML.trim(),s=n.id!==e.vidvertoId;a||s?(d=!0,setTimeout(()=>{I()},500),setTimeout(()=>{r.disconnect(),t("log","MutationObserver disconnected after successful styling")},1e3)):t("log","Skipping - div has no content and is same as placeholder")}),r.observe(i,{childList:!0,subtree:!0}),function(e){const o=e.vidvertoId+Date.now(),n=document.createElement("div");n.id=e.vidvertoId,i.appendChild(n);const r=document.createElement("script");r.textContent=`\n !function(v,t,o){\n var a=t.createElement("script");\n a.src="https://ad.vidverto.io/vidverto/js/aries/v1/invocation.js";\n a.setAttribute("fetchpriority","high");\n var r=v.top;\n r.document.head.appendChild(a);\n r.aries=r.aries||{},r.aries.v1=r.aries.v1||{commands:[]};\n var c=r.aries.v1;\n c.commands.push(function(){\n var d=document.getElementById("${e.vidvertoId}");\n if (d) {\n d.setAttribute("id", "${o}");\n var t = v.frameElement || d;\n const w = d.offsetWidth || 340;\n const h = d.offsetHeight || (w * 9 / 16);\n c.mount("${e.adSlotId}", t, { width: w, height: h });\n }\n });\n }(window, document);\n `,document.body.appendChild(r),t("log","βœ… Vidverto script injected")}(e),setTimeout(()=>{I()},1e3),t("log","βœ… Configurable Floating Video initialized successfully")):document.addEventListener("DOMContentLoaded",C)}setTimeout(()=>{n||(t("log","πŸ”„ Auto-initializing with configuration"),C())},100)}();