!function(){"use strict";class e{constructor(e){let t={root:null,rootMargin:"150px 0px 500px",threshold:this.buildThresholdList(),classTarget:this};this.observer=new IntersectionObserver(e,t)}addToObserver(e){this.observer.observe(e)}removeFromObserver(e){this.observer.unobserve(e)}buildThresholdList(){let e=[];for(let t=1;t<=6;t++){let a=t/6;e.push(a)}return e}}function t(e){let t=e.clientWidth,a=e.attributes.width?e.attributes.width.value:"auto",r=e.attributes.height?e.attributes.height.value:"auto",i="auto"===a||"auto"===r||"100%"===a||"100%"===r?e.clientHeight:parseInt(r/a*t);return t=parseInt(t),i=parseInt(i),isNaN(i)&&(i="auto"),{width:t,height:i}}function a(e,t){return Object.keys(t).forEach((function(a){e[a]=t[a]})),e}let r=new class{constructor(){this.serviceDomain=".i.optimole.com",this.serviceData={key:"undefined",quality:"auto",network_optimizations:!1,backgroundReplaceClasses:[],backgroundLazySelectors:"",watchClasses:[],lazyloadOnly:"",scalingDisabled:!1,ignoreDpr:!0},"undefined"!=typeof optimoleData&&optimoleData===Object(optimoleData)&&(this.serviceData=a(this.serviceData,optimoleData)),this.aTag=null}_cdnKey(){return this.serviceData.key.toLowerCase()}_sortByKey(e){const t={};return Object.keys(e).sort().forEach(a=>{t[a]=e[a]}),t}getAbsoluteUrl(e){return null===this.aTag&&(this.aTag=document.createElement("a")),this.aTag.href=e,this.aTag.href}getImageCDNUrl(e,t){if(e.includes(this.serviceDomain))return e;if("undefined"===this._cdnKey()||""===this._cdnKey())return e;e=this.getAbsoluteUrl(e);const a=`https://${this._cdnKey()}${this.serviceDomain}`;let r=this.serviceData.quality,i=e.split("://"),s=i[0],o=i[1];"auto"!==t.width&&(t.width=Math.round(t.width)),"auto"!==t.height&&(t.height=Math.round(t.height)),"eco"===t.quality&&(r=t.quality);let n={path:encodeURIComponent(o.replace(/\/$/,"")),scheme:s+":/",width:"w:"+t.width.toString(),height:"h:"+t.height.toString(),quality:"q:"+r.toString()};n=this._sortByKey(n);let l=[a,n.width,n.height,n.quality,n.scheme,o];return!1===this.serviceData.ignoreDpr&&window.devicePixelRatio>1&&l.splice(4,0,"dpr:"+window.devicePixelRatio.toFixed(1).toString()),l.join("/")}updateImages(e){let t=document.getElementsByTagName("img");for(let a=0;a1&&(e+="/dpr:"+window.devicePixelRatio.toFixed(1).toString())}let a=s[1]+":"+s[2],r=s[1]+":"+e;o.push({find:a.toString(),replace:r.toString()})}}let c=e;if(0===o.length)return e;for(let e in o)void 0!==o[e].find&&void 0!==o[e].replace&&(c=c.replace(o[e].find.toString(),o[e].replace.toString()));return c}sizeSafe(e){return null===e||"undefined"===e||"0"===e||0===e||isNaN(e)?"auto":e}qualityForConnection(e,t){if(!0!==this.network_optimizations)return t;let a;switch(e){case"4g":case"3g":a=t;break;case"2g":case"slow-2g":a="45";break;default:a=t}return a}sizeForConnection(e,t){if(!0!==this.network_optimizations)return t;let a=window.devicePixelRatio;switch(e){case"3g":return Math.round(t/a);case"2g":case"slow-2g":return Math.round(t/a);case"4g":default:return t}}getCDNForImage(e,r){let i=t(e);return i=a(i,r),{url:this.transformURL(this.getImageCDNUrl(e.dataset.optSrc,i),i),size:i}}},i=new class{constructor(e=null){this.replacerService=e}onlyLazyload(e){return void 0!==this.replacerService.serviceData.scalingDisabled&&!0===this.replacerService.serviceData.scalingDisabled||""!==this.replacerService.serviceData.lazyloadOnly&&e.classList.contains(this.replacerService.serviceData.lazyloadOnly)}requiresBetterQuality(e){return null===this.replacerService||"undefined"===this.replacerService||this.replacerService.requiresBetterQuality(e)}getImageSrc(e,r={}){let i=t(e);return i=a(i,r),null!==this.replacerService&&"undefined"!==this.replacerService?this.onlyLazyload(e)?{url:e.dataset.optSrc,size:i}:this.replacerService.getCDNForImage(e,i):"undefined"!==r&&"undefined"!==r.quality&&"eco"===r.quality?{url:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",size:i}:{url:e.dataset.optSrc,size:i}}prepareImage(e,t){let a=e.target;if((void 0===a.src||""===a.src)&&a.dataset.optSrc){let e={quality:"eco"},t=this.getImageSrc(a,e);a.src=t.url}t.addToObserver(a)}prepareEmbeddedVideo(e,t){let a=e.target;t.addToObserver(a)}skipLazyLoad(e){let t=e.target;if("IFRAME"===t.tagName&&t.dataset.optSrc)return t.src=t.dataset.optSrc,void(t.dataset.optLazyLoaded="true");if(t.dataset.optSrc){let e=this.getImageSrc(t);t.src=e.url,t.dataset.optLazyLoaded="true"}}lazyLoadImage(e){let t=e.target;if(void 0!==t.dataset.optSrc&&this.requiresBetterQuality(t)&&"true"!==t.dataset.optLazyLoaded){let e=this.getImageSrc(t),a=e.url,r=new Image;t.classList.add("optml_lazyload_img");let i=this;r.onload=async function(){this.complete&&(t.src=this.src,t.dataset.optLazyLoaded="true",null!==i.replacerService.serviceData&&!1===i.replacerService.serviceData.ignoreDpr&&window.devicePixelRatio>1&&(!i.onlyLazyload(t)&&"auto"!==e.size.width&&e.size.width>0&&(t.style.maxWidth=e.size.width+"px"),!t.width&&!t.height&&!t.classList.contains(i.replacerService.serviceData.lazyloadOnly)&&"auto"!==e.size.width&&"auto"!==e.size.height&&e.size.width>0&&e.size.height>0&&(t.width=""+e.size.width,t.height=""+e.size.height)),t.dataset.optOtimizedWidth=""+e.size.width,t.dataset.optOptimizedHeight=""+e.size.height,t.classList.remove("optml_lazyload_img"))};let s=t.parentNode;if(s&&/^picture$/i.test(s.nodeName||""))for(let e of s.getElementsByTagName("source"))if(e.srcset===t.currentSrc)return void(r.src=t.currentSrc);r.src=a}else if(null!==this.replacerService&&void 0!==this.replacerService){if("true"!==t.dataset.optLazyLoaded&&this.replacerService.serviceData.watchClasses.length>0)for(let e=0;e0)for(let e=0;e0){if(void 0===e.classList||0===e.classList.length)return!1;for(let t=0;t