(function(window){var smartload={assets:[],functions:[],loaded:new Set,log:false,isLibraryAvailable:function(lib){return typeof window[lib]!=="undefined"}};var USER_EVENTS=["keydown","mousemove","wheel","touchmove","touchstart","touchend"];var MAX_RETRIES=3;var FALLBACK_DELAY=1e4;var triggered=false;var fallbackTimer=null;var URL_PATTERN=/^(https?:)?\/\/[^\s]+$/;function wait(ms){return new Promise(function(resolve){setTimeout(resolve,ms)})}function log(){if(smartload.log){console.log.apply(console,["[SmartLoad]"].concat([].slice.call(arguments)))}}async function loadAsset(asset){var type=asset.type;var src=asset.src;var location=asset.location||"body";var callback=asset.callback;if(!URL_PATTERN.test(src)){console.error("[SmartLoad] Invalid URL:",src);return}if(smartload.loaded.has(src))return;for(var attempt=1;attempt<=MAX_RETRIES;attempt++){try{await new Promise(function(resolve,reject){var el;if(type==="script"){el=document.createElement("script");el.src=src;el["async"]=false}else if(type==="style"){el=document.createElement("link");el.rel="stylesheet";el.href=src}else{return resolve()}el.onload=resolve;el.onerror=reject;var parent=type==="script"?location==="head"?document.head:document.body:document.head;parent.appendChild(el)});smartload.loaded.add(src);log("Loaded:",src);if(typeof callback==="function"){try{callback()}catch(e){console.error("[SmartLoad] Callback error:",e)}}return}catch(e){var delay=Math.min(Math.pow(2,attempt)*200,4e3);log("Retry",attempt+"/"+MAX_RETRIES,"for",src,"in",delay+"ms");await wait(delay)}}console.error("[SmartLoad] Failed to load:",src)}async function loadAssetsSequential(list,done){for(var i=0;i-1?"&":"?")+(isSafari?"autoplay=0":"autoplay=1")+"&rel=0&modestbranding=1&showinfo=0";var iframe=document.createElement("iframe");iframe.src=url;iframe.allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture";iframe.allowFullscreen=true;iframe.frameBorder="0";iframe.width="100%";iframe.height="100%";iframe.className="iframe-youtube";el.innerHTML="";el.appendChild(iframe);el.removeAttribute("smartload-video")}if(isSafari){var io=new IntersectionObserver(function(entries,obs){entries.forEach(function(entry){if(entry.isIntersecting){activate();obs.unobserve(entry.target)}})},{rootMargin:"200px 0px",threshold:.01});io.observe(el)}else{el.setAttribute("role","button");el.setAttribute("tabindex","0");el.setAttribute("aria-label","Play video");el.style.cursor="pointer";el.addEventListener("click",activate,{once:true})}})}function triggerLoad(){if(triggered)return;triggered=true;clearTimeout(fallbackTimer);loadAssetsSequential(smartload.assets,function(){smartload.functions.forEach(function(fn){if(typeof fn==="function")fn()});processSmartloadAttributes();processSmartloadVideos()})}smartload.add=function(asset){if(!asset||!asset.src||!asset.type)return;if(asset.immediate===true){log("Immediate load:",asset.src);loadAsset(asset)}else{smartload.assets.push(asset)}};document.addEventListener("DOMContentLoaded",function(){processSmartloadAttributes();processSmartloadVideos();USER_EVENTS.forEach(function(evt){document.addEventListener(evt,triggerLoad,{once:true})});fallbackTimer=setTimeout(triggerLoad,FALLBACK_DELAY)});window.smartload=smartload})(window);