securityos/node_modules/next/dist/compiled/web-vitals-attribution/web-vitals.attribution.js

1 line
10 KiB
JavaScript
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
(function(){"use strict";var t={};!function(){t.d=function(g,b){for(var C in b){if(t.o(b,C)&&!t.o(g,C)){Object.defineProperty(g,C,{enumerable:true,get:b[C]})}}}}();!function(){t.o=function(t,g){return Object.prototype.hasOwnProperty.call(t,g)}}();!function(){t.r=function(t){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}}();if(typeof t!=="undefined")t.ab=__dirname+"/";var g={};t.r(g);t.d(g,{onCLS:function(){return w},onFCP:function(){return L},onFID:function(){return D},onINP:function(){return J},onLCP:function(){return Q},onTTFB:function(){return Y}});var b,C,F,P,A,a=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},o=function(t){if("loading"===document.readyState)return"loading";var g=a();if(g){if(t<g.domInteractive)return"loading";if(0===g.domContentLoadedEventStart||t<g.domContentLoadedEventStart)return"dom-interactive";if(0===g.domComplete||t<g.domComplete)return"dom-content-loaded"}return"complete"},u=function(t){var g=t.nodeName;return 1===t.nodeType?g.toLowerCase():g.toUpperCase().replace(/^#/,"")},c=function(t,g){var b="";try{for(;t&&9!==t.nodeType;){var C=t,F=C.id?"#"+C.id:u(C)+(C.className&&C.className.length?"."+C.className.replace(/\s+/g,"."):"");if(b.length+F.length>(g||100)-1)return b||F;if(b=b?F+">"+b:F,C.id)break;t=C.parentNode}}catch(t){}return b},N=-1,f=function(){return N},l=function(t){addEventListener("pageshow",(function(g){g.persisted&&(N=g.timeStamp,t(g))}),!0)},d=function(){var t=a();return t&&t.activationStart||0},m=function(t,g){var b=a(),C="navigate";return f()>=0?C="back-forward-cache":b&&(C=document.prerendering||d()>0?"prerender":b.type.replace(/_/g,"-")),{name:t,value:void 0===g?-1:g,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:C}},v=function(t,g,b){try{if(PerformanceObserver.supportedEntryTypes.includes(t)){var C=new PerformanceObserver((function(t){g(t.getEntries())}));return C.observe(Object.assign({type:t,buffered:!0},b||{})),C}}catch(t){}},p=function(t,g){var b=function n(b){"pagehide"!==b.type&&"hidden"!==document.visibilityState||(t(b),g&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",b,!0),addEventListener("pagehide",b,!0)},h=function(t,g,b,C){var F,P;return function(A){g.value>=0&&(A||C)&&((P=g.value-(F||0))||void 0===F)&&(F=g.value,g.delta=P,g.rating=function(t,g){return t>g[1]?"poor":t>g[0]?"needs-improvement":"good"}(g.value,b),t(g))}},q=-1,T=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},y=function(){p((function(t){var g=t.timeStamp;q=g}),!0)},E=function(){return q<0&&(q=T(),y(),l((function(){setTimeout((function(){q=T(),y()}),0)}))),{get firstHiddenTime(){return q}}},S=function(t,g){g=g||{};var b,C=[1800,3e3],F=E(),P=m("FCP"),o=function(t){t.forEach((function(t){"first-contentful-paint"===t.name&&(N&&N.disconnect(),t.startTime<F.firstHiddenTime&&(P.value=t.startTime-d(),P.entries.push(t),b(!0)))}))},A=window.performance&&window.performance.getEntriesByName&&window.performance.getEntriesByName("first-contentful-paint")[0],N=A?null:v("paint",o);(A||N)&&(b=h(t,P,C,g.reportAllChanges),A&&o([A]),l((function(F){P=m("FCP"),b=h(t,P,C,g.reportAllChanges),requestAnimationFrame((function(){requestAnimationFrame((function(){P.value=performance.now()-F.timeStamp,b(!0)}))}))})))},j=!1,_=-1,w=function(t,g){!function(t,g){g=g||{};var b=[.1,.25];j||(S((function(t){_=t.value})),j=!0);var C,i=function(g){_>-1&&t(g)},F=m("CLS",0),P=0,A=[],c=function(t){t.forEach((function(t){if(!t.hadRecentInput){var g=A[0],b=A[A.length-1];P&&t.startTime-b.startTime<1e3&&t.startTime-g.startTime<5e3?(P+=t.value,A.push(t)):(P=t.value,A=[t]),P>F.value&&(F.value=P,F.entries=A,C())}}))},N=v("layout-shift",c);N&&(C=h(i,F,b,g.reportAllChanges),p((function(){c(N.takeRecords()),C(!0)})),l((function(){P=0,_=-1,F=m("CLS",0),C=h(i,F,b,g.reportAllCh