(()=>{function i(t){let n=0;for(let e=0;e<t.length;e++){var r=t.charCodeAt(e);n=(n<<5)-n+r,n|=0}return(n>>>0).toString(16)}var n;if(bug_monitor.is4g=!(!navigator.connection||!navigator.connection.effectiveType||"4g"!=navigator.connection.effectiveType),new MutationObserver(e=>{for(var t of e)if("childList"===t.type&&0<t.addedNodes.length)for(var n of t.addedNodes)if(n instanceof Element&&!["SCRIPT","META","NOSCRIPT"].includes(n.nodeName)){o=r=void 0;var r=n;if(!["HTML","HEAD","BODY"].includes(r.nodeName)&&!r.dataset.bmid){let e=i(Array.from(r.attributes).map(e=>e.name+"="+e.value).join("&")).toString();var o=r.parentElement,o=(o&&(o=o.getAttribute("data-bmid")||o.id||o.nodeName,e=o+"/"+e),r.previousElementSibling);!o||o.id&&"wpadminbar"===o.id||(o=o.getAttribute("data-bmid")||o.id||o.nodeName,e=e+"/"+o),e=i(e).toString(),r.setAttribute("data-bmid",e)}}}).observe(document,{childList:!0,subtree:!0}),"on"==bug_monitor.config["network/csp"]&&document.addEventListener("securitypolicyviolation",function(e){bug_monitor.csp.push(e.blockedURI),bug_monitor.errors.push({type:"network/csp",level:"error",details:{url:e.blockedURI}})}),"on"!=bug_monitor.config["js/error"]&&"on"!=bug_monitor.config["network/mixed_content"]&&"on"!=bug_monitor.config["network/http"]||window.addEventListener("error",function(t){if(t.message){if(t.filename.match(/blob:/)){var e=document.querySelector('script[src="'+t.filename+'"]');if(e&&e.dataset.src){var n={},e=(["message","filename","lineno","error"].forEach(function(e){n[e]=t[e]}),e.dataset.src),r=new RegExp(t.filename,"g");n.filename=e;try{n.message=t.message.replace(t.filename,e),n.error.stack=t.error&&t.error.stack?t.error.stack.replace(r,e):""}catch(e){}t=n}}bug_monitor.errors.push({type:"js/error",level:"critical",details:{message:t.message,filename:t.filename,lineno:t.lineno,stack:t.error&&t.error.stack?t.error.stack:""}})}else if(t.target){r=t.target.src||t.target.href;if("string"==typeof r&&""!=r&&"https:"==document.location.protocol&&r.match(/^http:/))bug_monitor.errors.push({type:"network/mixed_content",level:"error",details:{url:r}});else{if(bug_monitor.csp.includes(r))return!0;bug_monitor.errors.push({type:"network/http",level:"error",details:{url:r}})}}return!0},!0),new PerformanceObserver(e=>{e.getEntries().forEach(e=>{var t;["xmlhttprequest","fetch"].includes(e.initiatorType)&&(document.dispatchEvent(new CustomEvent("bm/ajax/finished")),"on"!=bug_monitor.config["ux/slow_response"]||[bug_monitor.mutation_endpoint,bug_monitor.screenshot_endpoint,bug_monitor.session_endpoint].includes(e.name)||(t=e.duration,n<t&&bug_monitor.errors.push({type:"ux/slow_response",level:"warning",details:{request_type:"AJAX",url:e.name,duration:t}})))})}).observe({entryTypes:["resource"]}),n=navigator.connection&&navigator.connection.effectiveType&&"4g"==navigator.connection.effectiveType?800:2600,"on"==bug_monitor.config["webvitals/lcp"]||"on"==bug_monitor.config["webvitals/fcp"]||"on"==bug_monitor.config["webvitals/cls"]){bug_monitor.cls=0;let t=new PerformanceObserver(e=>{for(var t of e.getEntries())"largest-contentful-paint"==t.entryType&&2500<t.startTime?bug_monitor.errors.push({type:"webvitals/lcp",level:"warning",details:{value:t.startTime}}):"first-contentful-paint"==t.name&&1e3<t.startTime?bug_monitor.errors.push({type:"webvitals/fcp",level:"warning",details:{value:t.startTime}}):"layout-shift"==t.entryType&&(bug_monitor.cls+=t.value)});["paint","largest-contentful-paint","layout-shift"].filter(e=>PerformanceObserver.supportedEntryTypes.includes(e)).forEach(function(e){t.observe({type:e,buffered:!0})})}var e=XMLHttpRequest.prototype.send,t=(XMLHttpRequest.prototype.send=function(){setTimeout(function(){document.dispatchEvent(new CustomEvent("bm/ajax/send"))},100),e.apply(this,arguments)},window.fetch);window.fetch=function(){return setTimeout(function(){document.dispatchEvent(new CustomEvent("bm/ajax/send"))},100),t.apply(this,arguments)}})();