(()=>{var E=class{static getScreenWidth(){return window.innerWidth||document.documentElement.clientWidth}static getScreenHeight(){return window.innerHeight||document.documentElement.clientHeight}static isNotValidScreensize(e,t){const s=this.getScreenWidth(),r=this.getScreenHeight(),i=e&&(s>t.width||r>t.height),n=!e&&(s=0&&e.right>=0&&e.top<=(window.innerHeight||document.documentElement.clientHeight)&&e.left<=(window.innerWidth||document.documentElement.clientWidth)}static isPageScrolled(){return window.pageYOffset>0||document.documentElement.scrollTop>0}},f=E,_=class{constructor(e,t){this.config=e,this.performanceImages=[],this.logger=t}async run(){try{const e=this._generateLcpCandidates(1/0);e&&(this._initWithFirstElementWithInfo(e),this._fillATFWithoutDuplications(e))}catch(e){this.errorCode="script_error",this.logger.logMessage("Script Error: "+e)}}_generateLcpCandidates(e){const t=document.querySelectorAll(this.config.elements);return t.length<=0?[]:Array.from(t).map(i=>{if(i.nodeName.toLowerCase()==="img"&&i.parentElement.nodeName.toLowerCase()==="picture")return null;let n;if(i.nodeName.toLowerCase()==="picture"){const a=i.querySelector("img");if(a)n=a.getBoundingClientRect();else return null}else n=i.getBoundingClientRect();return{element:i,rect:n}}).filter(i=>i!==null).filter(i=>i.rect.width>0&&i.rect.height>0&&f.isIntersecting(i.rect)).map(i=>({item:i,area:this._getElementArea(i.rect),elementInfo:this._getElementInfo(i.element)})).sort((i,n)=>n.area-i.area).slice(0,e).map(i=>({element:i.item.element,elementInfo:i.elementInfo}))}_getElementArea(e){const t=Math.min(e.width,(window.innerWidth||document.documentElement.clientWidth)-e.left),s=Math.min(e.height,(window.innerHeight||document.documentElement.clientHeight)-e.top);return t*s}_getElementInfo(e){const t=e.nodeName.toLowerCase(),s={type:"",src:"",srcset:"",sizes:"",sources:[],bg_set:[],current_src:""},r=/url\(\s*?['"]?\s*?(.+?)\s*?["']?\s*?\)/ig;if(t==="img"&&e.srcset)s.type="img-srcset",s.src=e.src,s.srcset=e.srcset,s.sizes=e.sizes,s.current_src=e.currentSrc;else if(t==="img")s.type="img",s.src=e.src,s.current_src=e.currentSrc;else if(t==="video"){s.type="img";const i=e.querySelector("source");s.src=e.poster||(i?i.src:""),s.current_src=s.src}else if(t==="svg"){const i=e.querySelector("image");i&&(s.type="img",s.src=i.getAttribute("href")||"",s.current_src=s.src)}else if(t==="picture"){s.type="picture";const i=e.querySelector("img");s.src=i?i.src:"",s.sources=Array.from(e.querySelectorAll("source")).map(n=>({srcset:n.srcset||"",media:n.media||"",type:n.type||"",sizes:n.sizes||""}))}else{const n=[window.getComputedStyle(e,null).getPropertyValue("background-image"),getComputedStyle(e,":after").getPropertyValue("background-image"),getComputedStyle(e,":before").getPropertyValue("background-image")].filter(l=>l!=="none");if(n.length===0)return null;const a=n[0];if(s.type="bg-img",a.includes("image-set(")&&(s.type="bg-img-set"),!a||a===""||a.includes("data:image"))return null;const o=[...a.matchAll(r)];if(s.bg_set=o.map(l=>l[1]?{src:l[1].trim()+(l[2]?" "+l[2].trim():"")}:{}),s.bg_set.every(l=>l.src==="")&&(s.bg_set=o.map(l=>l[1]?{src:l[1].trim()}:{})),s.bg_set.length<=0)return null;s.bg_set.length>0&&(s.src=s.bg_set[0].src,s.type==="bg-img-set"&&(s.src=s.bg_set))}return s}_initWithFirstElementWithInfo(e){const t=e.find(s=>s.elementInfo!==null&&(s.elementInfo.src||s.elementInfo.srcset));if(!t){this.logger.logMessage("No LCP candidate found."),this.performanceImages=[];return}this.performanceImages=[{...t.elementInfo,label:"lcp"}]}_fillATFWithoutDuplications(e){e.forEach(({element:t,elementInfo:s})=>{this._isDuplicateImage(t)||!s||this.performanceImages.push({...s,label:"above-the-fold"})})}_isDuplicateImage(e){const t=this._getElementInfo(e);if(t===null)return!1;const s=t.type==="img"||t.type==="img-srcset"||t.type==="video",r=t.type==="bg-img"||t.type==="bg-img-set"||t.type==="picture";return(s||r)&&this.performanceImages.some(i=>i.src===t.src)}getResults(){return this.performanceImages}},S=_,F=class{constructor(e,t){this.config=e,this.logger=t,this.lazyRenderElements=[]}async run(){try{const e=this._getLazyRenderElements();e&&this._processElements(e)}catch(e){this.errorCode="script_error",this.logger.logMessage("Script Error: "+e)}}_getLazyRenderElements(){const e=document.querySelectorAll("[data-rocket-location-hash]"),t=this._getSvgUseTargets();return e.length<=0?[]:Array.from(e).filter(r=>this._skipElement(r)?!1:t.includes(r)?(this.logger.logColoredMessage(`Element skipped because of SVG: ${r.tagName}`,"orange"),!1):!0).map(r=>({element:r,depth:this._getElementDepth(r),distance:this._getElementDistance(r),hash:this._getLocationHash(r)}))}_getElementDepth(e){let t=0,s=e.parentElement;for(;s;)t++,s=s.parentElement;return t}_getElementDistance(e){const t=e.getBoundingClientRect(),s=window.pageYOffset||document.documentElement.scrollTop;return Math.max(0,t.top+s-f.getScreenHeight())}_skipElement(e){const t=this.config.skipStrings||["memex"];return!e||!e.id?!1:t.some(s=>e.id.toLowerCase().includes(s.toLowerCase()))}_shouldSkipElement(e,t){if(!e)return!1;for(let s=0;sparseFloat(s[a])<0);return(i||s.contentVisibility==="auto"||s.contentVisibility==="hidden")&&t.push({element:e,conflicts:[i&&"negative margin",s.contentVisibility==="auto"&&"content-visibility:auto",s.contentVisibility==="hidden"&&"content-visibility:hidden"].filter(Boolean)}),Array.from(e.children).forEach(a=>{const o=window.getComputedStyle(a),h=["marginTop","marginRight","marginBottom","marginLeft"].some(g=>parseFloat(o[g])<0);(h||o.position==="absolute"||o.position==="fixed")&&t.push({element:a,conflicts:[h&&"negative margin",o.position==="absolute"&&"position:absolute",o.position==="fixed"&&"position:fixed"].filter(Boolean)})}),t}_processElements(e){e.forEach(({element:t,depth:s,distance:r,hash:i})=>{if(this._shouldSkipElement(t,this.config.exclusions||[])||i==="No hash detected")return;const n=this._checkLcrConflict(t);if(n.length>0){this.logger.logMessage("Skipping element due to conflicts:",n);return}const a=t.parentElement&&this._getElementDistance(t.parentElement)=this.config.lrc_threshold,o=a?"green":r===0?"red":"";this.logger.logColoredMessage(`${" ".repeat(s)}${t.tagName} (Depth: ${s}, Distance from viewport bottom: ${r}px)`,o),this.logger.logColoredMessage(`${" ".repeat(s)}Location hash: ${i}`,o),this.logger.logColoredMessage(`${" ".repeat(s)}Dimensions Client Height: ${t.clientHeight}`,o),a&&(this.lazyRenderElements.push(i),this.logger.logMessage(`Element pushed with hash: ${i}`))})}_getXPath(e){return e&&e.id!==""?`//*[@id="${e.id}"]`:this._getElementXPath(e)}_getElementXPath(e){if(e===document.body)return"/html/body";const t=this._getElementPosition(e);return`${this._getElementXPath(e.parentNode)}/${e.nodeName.toLowerCase()}[${t}]`}_getElementPosition(e){let t=1,s=e.previousElementSibling;for(;s;)s.nodeName===e.nodeName&&t++,s=s.previousElementSibling;return t}_getLocationHash(e){return e.hasAttribute("data-rocket-location-hash")?e.getAttribute("data-rocket-location-hash"):"No hash detected"}_getSvgUseTargets(){const e=document.querySelectorAll("use"),t=new Set;return e.forEach(s=>{let r=s.parentElement;for(;r&&r!==document.body;)t.add(r),r=r.parentElement}),Array.from(t)}getResults(){return this.lazyRenderElements}},v=F,C=class{constructor(e,t){this.config=e,this.logger=t,this.aboveTheFoldFonts=[];const s=(Array.isArray(this.config.processed_extensions)&&this.config.processed_extensions.length>0?this.config.processed_extensions:["woff","woff2","ttf"]).map(r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");this.FONT_FILE_REGEX=new RegExp(`\\.(${s})(\\?.*)?$`,"i")}isExcluded(e,t){const s=this.config.preload_fonts_exclusions,r=new Set(s);return!!(r.has(e)||s.some(i=>e.includes(i))||Array.isArray(t)&&t.length>0&&(t.some(i=>r.has(i))||t.some(i=>s.some(n=>i.includes(n)))))}isElementVisible(e){const t=window.getComputedStyle(e),s=e.getBoundingClientRect();return!(t.display==="none"||t.visibility==="hidden"||t.opacity==="0"||s.width===0||s.height===0)}cleanUrl(e){try{return e=e.split("?")[0].split("#")[0],new URL(e,window.location.href).href}catch{return e}}async externalStylesheetsDoc(){function e(o){const l={};function h(g){if(!g)return null;const u=g.match(/url\s*\(\s*(['"]?)(.+?)\1\s*\)/);return u?u[2]:null}function c(g){return g?g.replace(/^['"]+|['"]+$/g,"").trim():""}return!o||!Array.isArray(o)?(console.warn("generateFontPairsFromStyleSheets: Input is not a valid array. Received:",o),l):(o.length===0||o.forEach(g=>{if(g&&g.cssRules)try{for(const u of g.cssRules)if(u.type===CSSRule.FONT_FACE_RULE){const d=u,w=c(d.style.getPropertyValue("font-family")),A=d.style.getPropertyValue("font-weight")||"normal",N=d.style.getPropertyValue("font-style")||"normal",R=d.style.getPropertyValue("src"),m=h(R);if(w&&m){const p={family:w,weight:A,style:N};l[m]||(l[m]=[]),l[m].some(y=>y.family===p.family&&y.weight===p.weight&&y.style===p.style)||l[m].push(p)}}}catch(u){console.warn("Error processing CSS rules from a stylesheet:",u,g)}else g&&!g.cssRules&&console.warn("Skipping a stylesheet as its cssRules are not accessible or it is empty:",g)}),l)}const t=["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","fonts.adobe.com","cdn.fonts.net"],s=[...document.querySelectorAll('link[rel="stylesheet"]')].filter(o=>t.some(l=>o.href.includes(l)));if(s.length===0)return this.logger.logMessage("No external CSS links found to process."),{styleSheets:[],fontPairs:{}};const r=s.map(o=>fetch(o.href,{mode:"cors"}).then(l=>l.ok?l.text():(console.warn(`Failed to fetch external CSS from ${o.href}: ${l.status} ${l.statusText}`),null)).catch(l=>(console.error(`Network error fetching external CSS from ${o.href}:`,l),null))),i=await Promise.all(r),n=[];i.forEach(o=>{if(o&&o.trim()!=="")try{const l=new CSSStyleSheet;l.replaceSync(o),n.push(l)}catch(l){console.error("Could not parse fetched CSS into a stylesheet:",l,` CSS (first 200 chars): ${o.substring(0,200)}...`)}}),n.length>0?this.logger.logMessage(`[Beacon] ${n.length} stylesheet(s) fetched and parsed into CSSStyleSheet objects.`):this.logger.logMessage("[Beacon] No stylesheets were successfully parsed from the fetched CSS.");const a=e(n);return{styleSheets:n,fontPairs:a}}async _initializeExternalFontSheets(){this.logger.logMessage("Initializing external font stylesheets...");try{const e=await this.externalStylesheetsDoc();this.externalParsedSheets=e.styleSheets||[],this.externalParsedPairs=e.fontPairs||[],this.logger.logMessage(`Successfully parsed ${this.externalParsedSheets.length} external font stylesheets.`)}catch(e){this.logger.logMessage("Error initializing external font stylesheets:",e),this.externalParsedSheets=[]}}getNetworkLoadedFonts(){return new Map(window.performance.getEntriesByType("resource").filter(e=>this.FONT_FILE_REGEX.test(e.name)).map(e=>[this.cleanUrl(e.name),e.name]))}getFontFaceRules(){const e={};return Array.from(Array.from(document.styleSheets)).filter(t=>!t.href||new URL(t.href).origin===location.origin).forEach(t=>{try{Array.from(t.cssRules||[]).forEach(s=>{if(s instanceof CSSFontFaceRule){const r=s.style.getPropertyValue("src"),i=s.style.getPropertyValue("font-family").replace(/['"]+/g,"").trim(),n=s.style.getPropertyValue("font-weight")||"400",a=s.style.getPropertyValue("font-style")||"normal";e[i]||(e[i]={urls:[],variations:new Set}),(r.match(/url\(['"]?([^'"]+)['"]?\)/g)||[]).forEach(l=>{let h=l.match(/url\(['"]?([^'"]+)['"]?\)/)[1];t.href&&(h=new URL(h,t.href).href);const c=this.cleanUrl(h);e[i].urls.includes(c)||(e[i].urls.push(c),e[i].variations.add(JSON.stringify({weight:n,style:a})))})}})}catch(s){this.logger.logMessage(s)}}),Object.values(e).forEach(t=>{t.variations=Array.from(t.variations).map(s=>JSON.parse(s))}),e}isElementAboveFold(e){if(!this.isElementVisible(e))return!1;const t=e.getBoundingClientRect(),s=window.pageYOffset||document.documentElement.scrollTop,r=t.top+s,i=window.innerHeight||document.documentElement.clientHeight;return r<=i}async run(){await document.fonts.ready,await this._initializeExternalFontSheets();const e=this.getNetworkLoadedFonts(),t=this.getFontFaceRules(),s=new Map,r=await this.processExternalFonts(this.externalParsedPairs);Array.from(document.getElementsByTagName("*")).filter(a=>this.isElementAboveFold(a)).forEach(a=>{const o=(l,h=null)=>{if(!l||!this.isElementVisible(a))return;const c=l.fontFamily.split(",")[0].replace(/['"]+/g,"").trim();if((h?l.content!=="none"&&l.content!=='""':a.textContent.trim())&&t[c]){let u=t[c].urls;!this.isExcluded(c,u)&&!s.has(c)&&(s.set(c,{elements:new Set,urls:u,variations:t[c].variations}),s.get(c).elements.add(a))}};try{o(window.getComputedStyle(a)),["::before","::after"].forEach(l=>{o(window.getComputedStyle(a,l),l)})}catch(l){this.logger.logMessage("Error processing element:",l)}});const n=this.summarizeMatches(r,s,e);if(!Object.keys(n.allFonts).length&&!Object.keys(n.externalFonts).length&&!Object.keys(n.hostedFonts).length){this.logger.logMessage("No fonts found above the fold.");return}this.logger.logMessage("Above the fold fonts:",n),this.aboveTheFoldFonts=[...new Set(Object.values(n.allFonts).flatMap(a=>a.variations.map(o=>o.url)))]}summarizeMatches(e,t,s){const r={},i={};return t.size>0&&t.forEach((n,a)=>{if(n.variations){const o=Array.from(n.elements),l=o.filter(c=>this.isElementAboveFold(c)),h=o.filter(c=>!this.isElementAboveFold(c));if(n.variations.forEach(c=>{let g=null;for(const u of n.urls){const d=this.cleanUrl(u);if(s.has(d)){g=s.get(d);break}}g&&(r[a]||(r[a]={type:"hosted",variations:[],elementCount:{aboveFold:l.length,belowFold:h.length,total:o.length},urlCount:{aboveFold:new Set,belowFold:new Set}}),r[a].variations.push({weight:c.weight,style:c.style,url:g,elementCount:{aboveFold:l.length,belowFold:h.length,total:o.length}}),l.length>0&&r[a].urlCount.aboveFold.add(g),h.length>0&&r[a].urlCount.belowFold.add(g))}),!Object.prototype.hasOwnProperty.call(r,a))return;r[a]&&(i[a]={variations:r[a].variations,elementCount:{...r[a].elementCount},urlCount:{...r[a].urlCount}})}}),Object.keys(e).length>0&&Object.entries(e).forEach(([n,a])=>{a.elementCount.aboveFold>0&&a.variations.forEach(o=>{r[o.family]||(r[o.family]={type:"external",variations:[],elementCount:{aboveFold:0,belowFold:0,total:0},urlCount:{aboveFold:new Set,belowFold:new Set}});const l=Array.from(a.elements).filter(c=>this.isElementAboveFold(c)),h=Array.from(a.elements).filter(c=>!this.isElementAboveFold(c));r[o.family].variations.push({weight:o.weight,style:o.style,url:n,elementCount:{aboveFold:l.length,belowFold:h.length,total:a.elements.length}}),r[o.family].elementCount.aboveFold+=l.length,r[o.family].elementCount.belowFold+=h.length,r[o.family].elementCount.total+=a.elements.length,l.length>0&&r[o.family].urlCount.aboveFold.add(n),h.length>0&&r[o.family].urlCount.belowFold.add(n)})}),Object.values(r).forEach(n=>{n.urlCount={aboveFold:n.urlCount.aboveFold.size,belowFold:n.urlCount.belowFold.size,total:new Set([...n.urlCount.aboveFold,...n.urlCount.belowFold]).size}}),Object.values(i).forEach(n=>{n.urlCount.aboveFold instanceof Set&&(n.urlCount={aboveFold:n.urlCount.aboveFold.size,belowFold:n.urlCount.belowFold.size,total:new Set([...n.urlCount.aboveFold,...n.urlCount.belowFold]).size})}),{externalFonts:Object.fromEntries(Object.entries(e).filter(n=>n[1].elementCount.aboveFold>0)),hostedFonts:i,allFonts:r}}async processExternalFonts(e){const t=new Map,s=Array.from(document.getElementsByTagName("*")).filter(n=>this.isElementAboveFold(n)),r=new Map;Object.entries(e).forEach(([n,a])=>{a.forEach(o=>{const l=`${o.family}|${o.weight}|${o.style}`;r.set(l,{url:n,...o})})});const i=n=>{const a=n.fontFamily.split(",")[0].replace(/['"]+/g,"").trim(),o=n.fontWeight,l=n.fontStyle,h=`${a}|${o}|${l}`;let c=r.get(h);if(!c&&o!=="400"){const g=`${a}|400|${l}`;c=r.get(g)}return c};return s.forEach(n=>{if(n.textContent.trim()){const a=window.getComputedStyle(n),o=i(a);o&&!this.isExcluded(o.family,[o.url])&&!t.has(o.url)&&(t.set(o.url,{elements:new Set,variations:new Set}),t.get(o.url).elements.add(n),t.get(o.url).variations.add(JSON.stringify({family:o.family,weight:o.weight,style:o.style})))}["::before","::after"].forEach(a=>{const o=window.getComputedStyle(n,a);if(o.content!=="none"&&o.content!=='""'){const l=i(o);l&&!this.isExcluded(l.family,[l.url])&&!t.has(l.url)&&(t.set(l.url,{elements:new Set,variations:new Set}),t.get(l.url).elements.add(n),t.get(l.url).variations.add(JSON.stringify({family:l.family,weight:l.weight,style:l.style})))}})}),Object.fromEntries(Array.from(t.entries()).map(([n,a])=>[n,{elementCount:{aboveFold:Array.from(a.elements).filter(o=>this.isElementAboveFold(o)).length,total:a.elements.size},variations:Array.from(a.variations).map(o=>JSON.parse(o)),elements:Array.from(a.elements)}]))}getResults(){return this.aboveTheFoldFonts}},x=C,B=class{constructor(e,t){this.logger=t,this.result=[],this.excludedPatterns=e.preconnect_external_domain_exclusions,this.eligibleElements=e.preconnect_external_domain_elements,this.matchedItems=new Set,this.excludedItems=new Set}async run(){document.querySelectorAll(`${this.eligibleElements.join(", ")}[src], ${this.eligibleElements.join(", ")}[href], ${this.eligibleElements.join(", ")}[rel], ${this.eligibleElements.join(", ")}[type]`).forEach(t=>this.processElement(t)),this.logger.logMessage({matchedItems:this.getMatchedItems(),excludedItems:Array.from(this.excludedItems)})}processElement(e){try{const t=new URL(e.src||e.href||"",location.href);if(this.isExcluded(e)){this.excludedItems.add(this.createExclusionObject(t,e));return}this.isExternalDomain(t)&&(this.matchedItems.add(`${t.hostname}-${e.tagName.toLowerCase()}`),this.result=[...new Set(this.result.concat(t.origin))])}catch(t){this.logger.logMessage(t)}}isExcluded(e){const t=e.outerHTML.substring(0,e.outerHTML.indexOf(">")+1);return this.excludedPatterns.some(s=>t.includes(s))}isExcludedByDomain(e){return this.excludedPatterns.some(t=>t.type==="domain"&&e.hostname.includes(t.value))}isExternalDomain(e){return e.hostname!==location.hostname&&e.hostname}createExclusionObject(e,t){return{domain:e.hostname,elementType:t.tagName.toLowerCase()}}getMatchedItems(){return Array.from(this.matchedItems).map(e=>{const t=e.lastIndexOf("-");return[e.substring(0,t),e.substring(t+1)]})}getResults(){return this.result}},M=B,P=class{constructor(e){this.enabled=e}logMessage(e,t=""){if(this.enabled){if(t!==""){console.log(e,t);return}console.log(e)}}logColoredMessage(e,t="green"){this.enabled&&console.log(`%c${e}`,`color: ${t};`)}},I=P,L=class{constructor(e){this.config=e,this.lcpBeacon=null,this.lrcBeacon=null,this.preloadFontsBeacon=null,this.preconnectExternalDomainBeacon=null,this.infiniteLoopId=null,this.errorCode="",this.logger=new I(this.config.debug)}async init(){if(this.scriptTimer=new Date,!await this._isValidPreconditions()){this._finalize();return}if(f.isPageScrolled()){this.logger.logMessage("Bailing out because the page has been scrolled"),this._finalize();return}this.infiniteLoopId=setTimeout(()=>{this._handleInfiniteLoop()},1e4);const e=await this._getGeneratedBefore(),t=this.config.status.atf&&(e===!1||e.lcp===!1),s=this.config.status.lrc&&(e===!1||e.lrc===!1),r=this.config.status.preload_fonts&&(e===!1||e.preload_fonts===!1),i=this.config.status.preconnect_external_domain&&(e===!1||e.preconnect_external_domain===!1);t?(this.lcpBeacon=new S(this.config,this.logger),await this.lcpBeacon.run()):this.logger.logMessage("Not running BeaconLcp because data is already available or feature is disabled"),s?(this.lrcBeacon=new v(this.config,this.logger),await this.lrcBeacon.run()):this.logger.logMessage("Not running BeaconLrc because data is already available or feature is disabled"),r?(this.preloadFontsBeacon=new x(this.config,this.logger),await this.preloadFontsBeacon.run()):this.logger.logMessage("Not running BeaconPreloadFonts because data is already available or feature is disabled"),i?(this.preconnectExternalDomainBeacon=new M(this.config,this.logger),await this.preconnectExternalDomainBeacon.run()):this.logger.logMessage("Not running BeaconPreconnectExternalDomain because data is already available or feature is disabled"),t||s||r||i?this._saveFinalResultIntoDB():(this.logger.logMessage("Not saving results into DB as no beacon features ran."),this._finalize())}async _isValidPreconditions(){const e={width:this.config.width_threshold,height:this.config.height_threshold};return f.isNotValidScreensize(this.config.is_mobile,e)?(this.logger.logMessage("Bailing out because screen size is not acceptable"),!1):!0}async _getGeneratedBefore(){if(!f.isPageCached())return!1;let e=new FormData;return e.append("action","rocket_check_beacon"),e.append("rocket_beacon_nonce",this.config.nonce),e.append("url",this.config.url),e.append("is_mobile",this.config.is_mobile),(await fetch(this.config.ajax_url,{method:"POST",credentials:"same-origin",body:e}).then(s=>s.json())).data}_saveFinalResultIntoDB(){const e={lcp:this.lcpBeacon?this.lcpBeacon.getResults():null,lrc:this.lrcBeacon?this.lrcBeacon.getResults():null,preload_fonts:this.preloadFontsBeacon?this.preloadFontsBeacon.getResults():null,preconnect_external_domain:this.preconnectExternalDomainBeacon?this.preconnectExternalDomainBeacon.getResults():null},t=new FormData;t.append("action","rocket_beacon"),t.append("rocket_beacon_nonce",this.config.nonce),t.append("url",this.config.url),t.append("is_mobile",this.config.is_mobile),t.append("status",this._getFinalStatus()),t.append("results",JSON.stringify(e)),fetch(this.config.ajax_url,{method:"POST",credentials:"same-origin",body:t,headers:{"wpr-saas-no-intercept":!0}}).then(s=>s.json()).then(s=>{this.logger.logMessage(s.data.lcp)}).catch(s=>{this.logger.logMessage(s)}).finally(()=>{this._finalize()})}_getFinalStatus(){return this.errorCode!==""?this.errorCode:10<=(new Date-this.scriptTimer)/1e3?"timeout":"success"}_handleInfiniteLoop(){this._saveFinalResultIntoDB()}_finalize(){document.querySelector('[data-name="wpr-wpr-beacon"]').setAttribute("beacon-completed","true"),clearTimeout(this.infiniteLoopId)}},b=L;(e=>{if(!e)return;const t=new b(e);if(document.readyState!=="loading"){setTimeout(()=>{t.init()},e.delay);return}document.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{t.init()},e.delay)})})(window.rocket_beacon_data);var $=b})(); //# sourceMappingURL=wpr-beacon.min.js.map