web-vitals
Advanced tools
Comparing version 3.1.1-soft-navs-3 to 3.1.1-soft-navs-4
@@ -16,2 +16,3 @@ /* | ||
*/ | ||
import { softNavs } from './softNavs.js'; | ||
/** | ||
@@ -26,2 +27,3 @@ * Takes a performance entry type and a callback function, and creates a | ||
export const observe = (type, callback, opts) => { | ||
const includeSoftNavigationObservations = softNavs(opts); | ||
try { | ||
@@ -40,2 +42,3 @@ if (PerformanceObserver.supportedEntryTypes.includes(type)) { | ||
buffered: true, | ||
includeSoftNavigationObservations: includeSoftNavigationObservations, | ||
}, opts || {})); | ||
@@ -42,0 +45,0 @@ return po; |
@@ -58,3 +58,4 @@ /* | ||
durationThreshold: 0, | ||
includeSoftNavigationObservations: softNavs, | ||
}); | ||
}; |
@@ -39,2 +39,3 @@ import { FirstInputPolyfillCallback } from './types/polyfills.js'; | ||
durationThreshold?: number; | ||
includeSoftNavigationObservations?: boolean; | ||
} | ||
@@ -41,0 +42,0 @@ interface PerformanceNavigationTiming { |
@@ -1,1 +0,1 @@ | ||
var webVitals=function(n){"use strict";var t,e,i,a,r,o=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},c=function(n){if("loading"===document.readyState)return"loading";var t=o();if(t){if(n<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||n<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||n<t.domComplete)return"dom-content-loaded"}return"complete"},u=function(n){var t=n.nodeName;return 1===n.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},s=function(n,t){var e="";try{for(;n&&9!==n.nodeType;){var i=n,a=i.id?"#"+i.id:u(i)+(i.className&&i.className.length?"."+i.className.replace(/\s+/g,"."):"");if(e.length+a.length>(t||100)-1)return e||a;if(e=e?a+">"+e:a,i.id)break;n=i.parentNode}}catch(n){}return e},f=-1,d=function(){return f},v=function(n){addEventListener("pageshow",(function(t){t.persisted&&(f=t.timeStamp,n(t))}),!0)},l=function(){var n=o();return n&&n.activationStart||0},g=function(n,t,e,i){var a=o(),r="navigate";return e?r=e:d()>=0?r="back-forward-cache":a&&(r=document.prerendering||l()>0?"prerender":document.wasDiscarded?"restore":a.type.replace(/_/g,"-")),{name:n,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r,navigationId:i||1}},m=function(n,t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var i=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return i.observe(Object.assign({type:n,buffered:!0},e||{})),i}}catch(n){}},p=function(n,t,e,i){var a,r;return function(o){t.value>=0&&(o||i)&&((r=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=r,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,e),n(t))}},h=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},T=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},y=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},I=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},E=-1,S=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},b=function(n){"hidden"===document.visibilityState&&E>-1&&(E="visibilitychange"===n.type?n.timeStamp:0,w())},C=function(){addEventListener("visibilitychange",b,!0),addEventListener("prerenderingchange",b,!0)},w=function(){removeEventListener("visibilitychange",b,!0),removeEventListener("prerenderingchange",b,!0)},L=function(){return E<0&&(E=S(),C(),v((function(){setTimeout((function(){E=S(),C()}),0)}))),{get firstHiddenTime(){return E}}},M=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},A=function(n,t){var e=y(t=t||{});M((function(){var i,a=[1800,3e3],r=L(),o=g("FCP"),c=m("paint",(function(u){u.forEach((function(u){if("first-contentful-paint"===u.name){e?(u.navigationId||1)>1&&(v="soft-navigation",m=u.navigationId,o=g("FCP",0,v,m),i=p(n,o,a,t.reportAllChanges)):c.disconnect();var s=0;if(u.navigationId&&1!==u.navigationId){var f=I(u.navigationId),d=(null==f?void 0:f.startTime)||0;s=Math.max(u.startTime-d,0)}else s=Math.max(u.startTime-l(),0);(u.startTime<r.firstHiddenTime||u.navigationId&&u.navigationId>1)&&(o.value=s,o.entries.push(u),o.navigationId=u.navigationId||1,i(!0))}var v,m}))}));c&&(i=p(n,o,a,t.reportAllChanges),v((function(e){o=g("FCP",0,"back-forward-cache",o.navigationId),i=p(n,o,a,t.reportAllChanges),h((function(){o.value=performance.now()-e.timeStamp,i(!0)}))})))}))},F={passive:!0,capture:!0},B=new Date,P=function(n,a){t||(t=a,e=n,i=new Date,D(removeEventListener),k())},k=function(){if(e>=0&&e<i-B){var n={entryType:"first-input",name:t.type,target:t.target,cancelable:t.cancelable,startTime:t.timeStamp,processingStart:t.timeStamp+e};a.forEach((function(t){t([n])})),a=[]}},x=function(n){if(n.cancelable){var t=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;"pointerdown"==n.type?function(n,t){var e=function(){P(n,t),a()},i=function(){a()},a=function(){removeEventListener("pointerup",e,F),removeEventListener("pointercancel",i,F)};addEventListener("pointerup",e,F),addEventListener("pointercancel",i,F)}(t,n):P(t,n)}},D=function(n){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return n(t,x,F)}))},N=function(n,i){var r=y(i=i||{});M((function(){var o,c=[100,300],u=L(),s=g("FID"),f=function(t){t.forEach((function(t){var e,a;r?(t.navigationId||1)>1&&(e="soft-navigation",a=t.navigationId,s=g("FID",0,e,a),o=p(n,s,c,i.reportAllChanges)):d.disconnect(),t.startTime<u.firstHiddenTime&&(s.value=t.processingStart-t.startTime,s.entries.push(t),s.navigationId=t.navigationId||1,o(!0))}))},d=m("first-input",f);o=p(n,s,c,i.reportAllChanges),d&&T((function(){f(d.takeRecords()),r||d.disconnect()})),d&&v((function(){var r;s=g("FID",0,"back-forward-cache",s.navigationId),o=p(n,s,c,i.reportAllChanges),a=[],e=-1,t=null,D(addEventListener),r=f,a.push(r),k()}))}))},R=0,q=1/0,O=0,H=1,_=!1,j=function(n){n.forEach((function(n){n.interactionId&&(_&&n.navigationId&&n.navigationId>H&&(H=n.navigationId,R=0,q=1/0,O=0),q=Math.min(q,n.interactionId),O=Math.max(O,n.interactionId),R=O?(O-q)/7+1:0)}))},V=function(){return r?R:performance.interactionCount||0},U=function(n){"interactionCount"in performance||r||(_=n||!1,r=m("event",j,{type:"event",buffered:!0,durationThreshold:0}))},z=0,G=function(){return V()-z},J=[],K={},Q=function(n){var t=J[J.length-1],e=K[n.interactionId];if(e||J.length<10||n.duration>t.latency){if(e)e.entries.push(n),e.latency=Math.max(e.latency,n.duration);else{var i={id:n.interactionId,latency:n.duration,entries:[n]};K[i.id]=i,J.push(i)}J.sort((function(n,t){return t.latency-n.latency})),J.splice(10).forEach((function(n){delete K[n.id]}))}},W=function(n,t){var e=y(t=t||{}),i=!1;M((function(){var a=[200,500];U(e);var r,o=g("INP"),c=function(e,c){J=[],z="soft-navigation"===e?0:V(),o=g("INP",0,e,c),r=p(n,o,a,t.reportAllChanges),i=!1},u=function(){var n,e,i=(e=Math.min(J.length-1,Math.floor(G()/50)),J[e]);i&&(i.latency!==o.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(o.value=i.latency,o.entries=i.entries)},s=function(n){n.forEach((function(n){(e&&n.navigationId&&n.navigationId>o.navigationId&&(i||(u(),o.value>0&&r(!0)),c("soft-navigation",n.navigationId)),n.interactionId&&Q(n),"first-input"===n.entryType)&&(!J.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&Q(n))})),u(),r()},f=m("event",s,{durationThreshold:t.durationThreshold||40});if(r=p(n,o,a,t.reportAllChanges),f){f.observe({type:"first-input",buffered:!0}),T((function(){s(f.takeRecords()),o.value<0&&G()>0&&(o.value=0,o.entries=[]),r(!0)})),v((function(){c("back-forward-cache",o.navigationId),h((function(){return r()}))}));e&&m("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&e.navigationId>o.navigationId&&(!i&&o.value>0&&r(!0),c("soft-navigation",e.navigationId),r=p(n,o,a,t.reportAllChanges))}))}))}}))},X=function n(t){document.prerendering?M((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},Y=function(n,t){var e=y(t=t||{}),i=[800,1800],a=g("TTFB"),r=p(n,a,i,t.reportAllChanges);X((function(){var c=o();if(c){var u=c.responseStart;if(u<=0||u>performance.now())return;a.value=Math.max(u-l(),0),a.entries=[c],r(!0),v((function(){a=g("TTFB",0,"back-forward-cache",a.navigationId),(r=p(n,a,i,t.reportAllChanges))(!0)}));e&&m("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&(a=g("TTFB",0,"soft-navigation",e.navigationId),(r=p(n,a,i,t.reportAllChanges))(!0))}))}))}}))};return n.onCLS=function(n,t){!function(n,t){var e,i,a=y(t=t||{}),r=!1;A((e=function(){var e,i=[.1,.25],o=g("CLS",0),c=0,u=[],s=function(a,u){o=g("CLS",0,a,u),e=p(n,o,i,t.reportAllChanges),c=0,r=!1},f=function(n){n.forEach((function(n){if(a&&n.navigationId&&n.navigationId>o.navigationId&&(c>o.value&&(o.value=c,o.entries=u),e(!0),s("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=u[0],i=u[u.length-1];c&&n.startTime-i.startTime<1e3&&n.startTime-t.startTime<5e3?(c+=n.value,u.push(n)):(c=n.value,u=[n])}})),c>o.value&&(o.value=c,o.entries=u,e())},d=m("layout-shift",f);d&&(e=p(n,o,i,t.reportAllChanges),T((function(){f(d.takeRecords()),e(!0),r=!0})),v((function(){s("back-forward-cache",o.navigationId),h((function(){return e()}))})),a&&m("soft-navigation",(function(a){a.forEach((function(a){a.navigationId&&a.navigationId>o.navigationId&&(r||e(!0),s("soft-navigation",a.navigationId),e=p(n,o,i,t.reportAllChanges))}))})),setTimeout(e,0))},i=!1,function(n){i||(e(n),i=!0)}))}((function(t){!function(n){if(n.entries.length){var t=n.entries.reduce((function(n,t){return n&&n.value>t.value?n:t}));if(t&&t.sources&&t.sources.length){var e=(i=t.sources).find((function(n){return n.node&&1===n.node.nodeType}))||i[0];if(e)return void(n.attribution={largestShiftTarget:s(e.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:e,largestShiftEntry:t,loadState:c(t.startTime)})}}var i;n.attribution={}}(t),n(t)}),t)},n.onFCP=function(n,t){A((function(t){!function(n){if(n.entries.length){var t,e=n.entries[n.entries.length-1],i=0,a=0;if(n.navigationId&&1!==n.navigationId?t=I(n.navigationId):(t=o())&&(i=t.activationStart||0,a=Math.max(0,t.responseStart-i)),t)return void(n.attribution={timeToFirstByte:a,firstByteToFCP:n.value-a,loadState:c(n.entries[0].startTime),navigationEntry:t,fcpEntry:e})}n.attribution={timeToFirstByte:0,firstByteToFCP:n.value,loadState:c(d())}}(t),n(t)}),t)},n.onFID=function(n,t){N((function(t){!function(n){var t=n.entries[0];n.attribution={eventTarget:s(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:c(t.startTime)}}(t),n(t)}),t)},n.onINP=function(n,t){W((function(t){!function(n){if(n.entries.length){var t=n.entries.sort((function(n,t){return t.duration-n.duration||t.processingEnd-t.processingStart-(n.processingEnd-n.processingStart)}))[0];n.attribution={eventTarget:s(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:c(t.startTime)}}else n.attribution={}}(t),n(t)}),t)},n.onLCP=function(n,t){!function(n,t){var e=!1,i=y(t=t||{});M((function(){var a,r=[2500,4e3],o=L(),c=g("LCP"),u=function(i,o){c=g("LCP",0,i,o),a=p(n,c,r,t.reportAllChanges),e=!1},s=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>c.navigationId&&(e||a(!0),u("soft-navigation",n.navigationId));var t,i=0;i=1!==n.navigationId&&n.navigationId?Math.max(n.startTime-((null===(t=I(n.navigationId))||void 0===t?void 0:t.startTime)||0),0):Math.max(n.startTime-l(),0),n.startTime<o.firstHiddenTime&&(c.value=i,c.entries=[n],c.navigationId=n.navigationId||1,a())}}))},f=function(){e||(s(d.takeRecords()),i||d.disconnect(),e=!0,a(!0))},d=m("largest-contentful-paint",s);d&&(a=p(n,c,r,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,f,!0)})),T(f),v((function(n){u("back-forward-cache",c.navigationId),h((function(){c.value=performance.now()-n.timeStamp,e=!0,a(!0)}))})),i&&m("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>c.navigationId&&(e||a(!0),u("soft-navigation",n.navigationId))}))})))}))}((function(t){!function(n){if(n.entries.length){var t,e=0,i=0;if(n.navigationId&&1!==n.navigationId?t=I():(t=o())&&(e=t.activationStart||0,i=t.responseStart||0),t){var a=n.entries[n.entries.length-1],r=a.url&&performance.getEntriesByType("resource").filter((function(n){return n.name===a.url}))[0],c=Math.max(0,i-e),u=Math.max(c,r?(r.requestStart||r.startTime)-e:0),f=Math.max(u,r?r.responseEnd-e:0),d=Math.max(f,a?a.startTime-e:0),v={element:s(a.element),timeToFirstByte:c,resourceLoadDelay:u-c,resourceLoadTime:f-u,elementRenderDelay:d-f,navigationEntry:t,lcpEntry:a};return a.url&&(v.url=a.url),r&&(v.lcpResourceEntry=r),void(n.attribution=v)}}n.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:n.value}}(t),n(t)}),t)},n.onTTFB=function(n,t){Y((function(t){!function(n){if(n.entries.length){var t=n.entries[0],e=t.activationStart||0,i=Math.max(t.domainLookupStart-e,0),a=Math.max(t.connectStart-e,0),r=Math.max(t.requestStart-e,0);n.attribution={waitingTime:i,dnsTime:a-i,connectionTime:r-a,requestTime:n.value-r,navigationEntry:t}}else n.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(t),n(t)}),t)},Object.defineProperty(n,"__esModule",{value:!0}),n}({}); | ||
var webVitals=function(n){"use strict";var t,e,i,a,r,o=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},c=function(n){if("loading"===document.readyState)return"loading";var t=o();if(t){if(n<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||n<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||n<t.domComplete)return"dom-content-loaded"}return"complete"},u=function(n){var t=n.nodeName;return 1===n.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},s=function(n,t){var e="";try{for(;n&&9!==n.nodeType;){var i=n,a=i.id?"#"+i.id:u(i)+(i.className&&i.className.length?"."+i.className.replace(/\s+/g,"."):"");if(e.length+a.length>(t||100)-1)return e||a;if(e=e?a+">"+e:a,i.id)break;n=i.parentNode}}catch(n){}return e},f=-1,d=function(){return f},v=function(n){addEventListener("pageshow",(function(t){t.persisted&&(f=t.timeStamp,n(t))}),!0)},l=function(){var n=o();return n&&n.activationStart||0},g=function(n,t,e,i){var a=o(),r="navigate";return e?r=e:d()>=0?r="back-forward-cache":a&&(r=document.prerendering||l()>0?"prerender":document.wasDiscarded?"restore":a.type.replace(/_/g,"-")),{name:n,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r,navigationId:i||1}},m=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},p=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},h=function(n,t,e){var i=m(e);try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var a=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return a.observe(Object.assign({type:n,buffered:!0,includeSoftNavigationObservations:i},e||{})),a}}catch(n){}},T=function(n,t,e,i){var a,r;return function(o){t.value>=0&&(o||i)&&((r=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=r,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,e),n(t))}},y=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},I=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},E=-1,S=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},b=function(n){"hidden"===document.visibilityState&&E>-1&&(E="visibilitychange"===n.type?n.timeStamp:0,w())},C=function(){addEventListener("visibilitychange",b,!0),addEventListener("prerenderingchange",b,!0)},w=function(){removeEventListener("visibilitychange",b,!0),removeEventListener("prerenderingchange",b,!0)},L=function(){return E<0&&(E=S(),C(),v((function(){setTimeout((function(){E=S(),C()}),0)}))),{get firstHiddenTime(){return E}}},M=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},A=function(n,t){var e=m(t=t||{});M((function(){var i,a=[1800,3e3],r=L(),o=g("FCP"),c=h("paint",(function(u){u.forEach((function(u){if("first-contentful-paint"===u.name){e?(u.navigationId||1)>1&&(v="soft-navigation",m=u.navigationId,o=g("FCP",0,v,m),i=T(n,o,a,t.reportAllChanges)):c.disconnect();var s=0;if(u.navigationId&&1!==u.navigationId){var f=p(u.navigationId),d=(null==f?void 0:f.startTime)||0;s=Math.max(u.startTime-d,0)}else s=Math.max(u.startTime-l(),0);(u.startTime<r.firstHiddenTime||u.navigationId&&u.navigationId>1)&&(o.value=s,o.entries.push(u),o.navigationId=u.navigationId||1,i(!0))}var v,m}))}));c&&(i=T(n,o,a,t.reportAllChanges),v((function(e){o=g("FCP",0,"back-forward-cache",o.navigationId),i=T(n,o,a,t.reportAllChanges),y((function(){o.value=performance.now()-e.timeStamp,i(!0)}))})))}))},F={passive:!0,capture:!0},B=new Date,P=function(n,a){t||(t=a,e=n,i=new Date,D(removeEventListener),k())},k=function(){if(e>=0&&e<i-B){var n={entryType:"first-input",name:t.type,target:t.target,cancelable:t.cancelable,startTime:t.timeStamp,processingStart:t.timeStamp+e};a.forEach((function(t){t([n])})),a=[]}},x=function(n){if(n.cancelable){var t=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;"pointerdown"==n.type?function(n,t){var e=function(){P(n,t),a()},i=function(){a()},a=function(){removeEventListener("pointerup",e,F),removeEventListener("pointercancel",i,F)};addEventListener("pointerup",e,F),addEventListener("pointercancel",i,F)}(t,n):P(t,n)}},D=function(n){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return n(t,x,F)}))},N=function(n,i){var r=m(i=i||{});M((function(){var o,c=[100,300],u=L(),s=g("FID"),f=function(t){t.forEach((function(t){var e,a;r?(t.navigationId||1)>1&&(e="soft-navigation",a=t.navigationId,s=g("FID",0,e,a),o=T(n,s,c,i.reportAllChanges)):d.disconnect(),t.startTime<u.firstHiddenTime&&(s.value=t.processingStart-t.startTime,s.entries.push(t),s.navigationId=t.navigationId||1,o(!0))}))},d=h("first-input",f);o=T(n,s,c,i.reportAllChanges),d&&I((function(){f(d.takeRecords()),r||d.disconnect()})),d&&v((function(){var r;s=g("FID",0,"back-forward-cache",s.navigationId),o=T(n,s,c,i.reportAllChanges),a=[],e=-1,t=null,D(addEventListener),r=f,a.push(r),k()}))}))},R=0,O=1/0,q=0,H=1,_=!1,j=function(n){n.forEach((function(n){n.interactionId&&(_&&n.navigationId&&n.navigationId>H&&(H=n.navigationId,R=0,O=1/0,q=0),O=Math.min(O,n.interactionId),q=Math.max(q,n.interactionId),R=q?(q-O)/7+1:0)}))},V=function(){return r?R:performance.interactionCount||0},U=function(n){"interactionCount"in performance||r||(_=n||!1,r=h("event",j,{type:"event",buffered:!0,durationThreshold:0,includeSoftNavigationObservations:n}))},z=0,G=function(){return V()-z},J=[],K={},Q=function(n){var t=J[J.length-1],e=K[n.interactionId];if(e||J.length<10||n.duration>t.latency){if(e)e.entries.push(n),e.latency=Math.max(e.latency,n.duration);else{var i={id:n.interactionId,latency:n.duration,entries:[n]};K[i.id]=i,J.push(i)}J.sort((function(n,t){return t.latency-n.latency})),J.splice(10).forEach((function(n){delete K[n.id]}))}},W=function(n,t){var e=m(t=t||{}),i=!1;M((function(){var a=[200,500];U(e);var r,o=g("INP"),c=function(e,c){J=[],z="soft-navigation"===e?0:V(),o=g("INP",0,e,c),r=T(n,o,a,t.reportAllChanges),i=!1},u=function(){var n,e,i=(e=Math.min(J.length-1,Math.floor(G()/50)),J[e]);i&&(i.latency!==o.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(o.value=i.latency,o.entries=i.entries)},s=function(n){n.forEach((function(n){(e&&n.navigationId&&n.navigationId>o.navigationId&&(i||(u(),o.value>0&&r(!0)),c("soft-navigation",n.navigationId)),n.interactionId&&Q(n),"first-input"===n.entryType)&&(!J.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&Q(n))})),u(),r()},f=h("event",s,{durationThreshold:t.durationThreshold||40});if(r=T(n,o,a,t.reportAllChanges),f){f.observe({type:"first-input",buffered:!0}),I((function(){s(f.takeRecords()),o.value<0&&G()>0&&(o.value=0,o.entries=[]),r(!0)})),v((function(){c("back-forward-cache",o.navigationId),y((function(){return r()}))}));e&&h("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&e.navigationId>o.navigationId&&(!i&&o.value>0&&r(!0),c("soft-navigation",e.navigationId),r=T(n,o,a,t.reportAllChanges))}))}))}}))},X=function n(t){document.prerendering?M((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},Y=function(n,t){var e=m(t=t||{}),i=[800,1800],a=g("TTFB"),r=T(n,a,i,t.reportAllChanges);X((function(){var c=o();if(c){var u=c.responseStart;if(u<=0||u>performance.now())return;a.value=Math.max(u-l(),0),a.entries=[c],r(!0),v((function(){a=g("TTFB",0,"back-forward-cache",a.navigationId),(r=T(n,a,i,t.reportAllChanges))(!0)}));e&&h("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&(a=g("TTFB",0,"soft-navigation",e.navigationId),(r=T(n,a,i,t.reportAllChanges))(!0))}))}))}}))};return n.onCLS=function(n,t){!function(n,t){var e,i,a=m(t=t||{}),r=!1;A((e=function(){var e,i=[.1,.25],o=g("CLS",0),c=0,u=[],s=function(a,u){o=g("CLS",0,a,u),e=T(n,o,i,t.reportAllChanges),c=0,r=!1},f=function(n){n.forEach((function(n){if(a&&n.navigationId&&n.navigationId>o.navigationId&&(c>o.value&&(o.value=c,o.entries=u),e(!0),s("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=u[0],i=u[u.length-1];c&&n.startTime-i.startTime<1e3&&n.startTime-t.startTime<5e3?(c+=n.value,u.push(n)):(c=n.value,u=[n])}})),c>o.value&&(o.value=c,o.entries=u,e())},d=h("layout-shift",f);d&&(e=T(n,o,i,t.reportAllChanges),I((function(){f(d.takeRecords()),e(!0),r=!0})),v((function(){s("back-forward-cache",o.navigationId),y((function(){return e()}))})),a&&h("soft-navigation",(function(a){a.forEach((function(a){a.navigationId&&a.navigationId>o.navigationId&&(r||e(!0),s("soft-navigation",a.navigationId),e=T(n,o,i,t.reportAllChanges))}))})),setTimeout(e,0))},i=!1,function(n){i||(e(n),i=!0)}))}((function(t){!function(n){if(n.entries.length){var t=n.entries.reduce((function(n,t){return n&&n.value>t.value?n:t}));if(t&&t.sources&&t.sources.length){var e=(i=t.sources).find((function(n){return n.node&&1===n.node.nodeType}))||i[0];if(e)return void(n.attribution={largestShiftTarget:s(e.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:e,largestShiftEntry:t,loadState:c(t.startTime)})}}var i;n.attribution={}}(t),n(t)}),t)},n.onFCP=function(n,t){A((function(t){!function(n){if(n.entries.length){var t,e=n.entries[n.entries.length-1],i=0,a=0;if(n.navigationId&&1!==n.navigationId?t=p(n.navigationId):(t=o())&&(i=t.activationStart||0,a=Math.max(0,t.responseStart-i)),t)return void(n.attribution={timeToFirstByte:a,firstByteToFCP:n.value-a,loadState:c(n.entries[0].startTime),navigationEntry:t,fcpEntry:e})}n.attribution={timeToFirstByte:0,firstByteToFCP:n.value,loadState:c(d())}}(t),n(t)}),t)},n.onFID=function(n,t){N((function(t){!function(n){var t=n.entries[0];n.attribution={eventTarget:s(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:c(t.startTime)}}(t),n(t)}),t)},n.onINP=function(n,t){W((function(t){!function(n){if(n.entries.length){var t=n.entries.sort((function(n,t){return t.duration-n.duration||t.processingEnd-t.processingStart-(n.processingEnd-n.processingStart)}))[0];n.attribution={eventTarget:s(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:c(t.startTime)}}else n.attribution={}}(t),n(t)}),t)},n.onLCP=function(n,t){!function(n,t){var e=!1,i=m(t=t||{});M((function(){var a,r=[2500,4e3],o=L(),c=g("LCP"),u=function(i,o){c=g("LCP",0,i,o),a=T(n,c,r,t.reportAllChanges),e=!1},s=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>c.navigationId&&(e||a(!0),u("soft-navigation",n.navigationId));var t,i=0;i=1!==n.navigationId&&n.navigationId?Math.max(n.startTime-((null===(t=p(n.navigationId))||void 0===t?void 0:t.startTime)||0),0):Math.max(n.startTime-l(),0),n.startTime<o.firstHiddenTime&&(c.value=i,c.entries=[n],c.navigationId=n.navigationId||1,a())}}))},f=function(){e||(s(d.takeRecords()),i||d.disconnect(),e=!0,a(!0))},d=h("largest-contentful-paint",s);d&&(a=T(n,c,r,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,f,!0)})),I(f),v((function(n){u("back-forward-cache",c.navigationId),y((function(){c.value=performance.now()-n.timeStamp,e=!0,a(!0)}))})),i&&h("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>c.navigationId&&(e||a(!0),u("soft-navigation",n.navigationId))}))})))}))}((function(t){!function(n){if(n.entries.length){var t,e=0,i=0;if(n.navigationId&&1!==n.navigationId?t=p():(t=o())&&(e=t.activationStart||0,i=t.responseStart||0),t){var a=n.entries[n.entries.length-1],r=a.url&&performance.getEntriesByType("resource").filter((function(n){return n.name===a.url}))[0],c=Math.max(0,i-e),u=Math.max(c,r?(r.requestStart||r.startTime)-e:0),f=Math.max(u,r?r.responseEnd-e:0),d=Math.max(f,a?a.startTime-e:0),v={element:s(a.element),timeToFirstByte:c,resourceLoadDelay:u-c,resourceLoadTime:f-u,elementRenderDelay:d-f,navigationEntry:t,lcpEntry:a};return a.url&&(v.url=a.url),r&&(v.lcpResourceEntry=r),void(n.attribution=v)}}n.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:n.value}}(t),n(t)}),t)},n.onTTFB=function(n,t){Y((function(t){!function(n){if(n.entries.length){var t=n.entries[0],e=t.activationStart||0,i=Math.max(t.domainLookupStart-e,0),a=Math.max(t.connectStart-e,0),r=Math.max(t.requestStart-e,0);n.attribution={waitingTime:i,dnsTime:a-i,connectionTime:r-a,requestTime:n.value-r,navigationEntry:t}}else n.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(t),n(t)}),t)},Object.defineProperty(n,"__esModule",{value:!0}),n}({}); |
@@ -1,1 +0,1 @@ | ||
var n,t,e,i,a,r=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},o=function(n){if("loading"===document.readyState)return"loading";var t=r();if(t){if(n<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||n<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||n<t.domComplete)return"dom-content-loaded"}return"complete"},c=function(n){var t=n.nodeName;return 1===n.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},u=function(n,t){var e="";try{for(;n&&9!==n.nodeType;){var i=n,a=i.id?"#"+i.id:c(i)+(i.className&&i.className.length?"."+i.className.replace(/\s+/g,"."):"");if(e.length+a.length>(t||100)-1)return e||a;if(e=e?a+">"+e:a,i.id)break;n=i.parentNode}}catch(n){}return e},s=-1,f=function(){return s},d=function(n){addEventListener("pageshow",(function(t){t.persisted&&(s=t.timeStamp,n(t))}),!0)},v=function(){var n=r();return n&&n.activationStart||0},l=function(n,t,e,i){var a=r(),o="navigate";return e?o=e:f()>=0?o="back-forward-cache":a&&(o=document.prerendering||v()>0?"prerender":document.wasDiscarded?"restore":a.type.replace(/_/g,"-")),{name:n,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:o,navigationId:i||1}},g=function(n,t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var i=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return i.observe(Object.assign({type:n,buffered:!0},e||{})),i}}catch(n){}},m=function(n,t,e,i){var a,r;return function(o){t.value>=0&&(o||i)&&((r=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=r,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,e),n(t))}},p=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},h=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},T=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},y=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},I=-1,E=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},S=function(n){"hidden"===document.visibilityState&&I>-1&&(I="visibilitychange"===n.type?n.timeStamp:0,C())},b=function(){addEventListener("visibilitychange",S,!0),addEventListener("prerenderingchange",S,!0)},C=function(){removeEventListener("visibilitychange",S,!0),removeEventListener("prerenderingchange",S,!0)},w=function(){return I<0&&(I=E(),b(),d((function(){setTimeout((function(){I=E(),b()}),0)}))),{get firstHiddenTime(){return I}}},L=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},A=function(n,t){var e=T(t=t||{});L((function(){var i,a=[1800,3e3],r=w(),o=l("FCP"),c=g("paint",(function(u){u.forEach((function(u){if("first-contentful-paint"===u.name){e?(u.navigationId||1)>1&&(g="soft-navigation",p=u.navigationId,o=l("FCP",0,g,p),i=m(n,o,a,t.reportAllChanges)):c.disconnect();var s=0;if(u.navigationId&&1!==u.navigationId){var f=y(u.navigationId),d=(null==f?void 0:f.startTime)||0;s=Math.max(u.startTime-d,0)}else s=Math.max(u.startTime-v(),0);(u.startTime<r.firstHiddenTime||u.navigationId&&u.navigationId>1)&&(o.value=s,o.entries.push(u),o.navigationId=u.navigationId||1,i(!0))}var g,p}))}));c&&(i=m(n,o,a,t.reportAllChanges),d((function(e){o=l("FCP",0,"back-forward-cache",o.navigationId),i=m(n,o,a,t.reportAllChanges),p((function(){o.value=performance.now()-e.timeStamp,i(!0)}))})))}))},M=function(n,t){!function(n,t){var e,i,a=T(t=t||{}),r=!1;A((e=function(){var e,i=[.1,.25],o=l("CLS",0),c=0,u=[],s=function(a,u){o=l("CLS",0,a,u),e=m(n,o,i,t.reportAllChanges),c=0,r=!1},f=function(n){n.forEach((function(n){if(a&&n.navigationId&&n.navigationId>o.navigationId&&(c>o.value&&(o.value=c,o.entries=u),e(!0),s("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=u[0],i=u[u.length-1];c&&n.startTime-i.startTime<1e3&&n.startTime-t.startTime<5e3?(c+=n.value,u.push(n)):(c=n.value,u=[n])}})),c>o.value&&(o.value=c,o.entries=u,e())},v=g("layout-shift",f);v&&(e=m(n,o,i,t.reportAllChanges),h((function(){f(v.takeRecords()),e(!0),r=!0})),d((function(){s("back-forward-cache",o.navigationId),p((function(){return e()}))})),a&&g("soft-navigation",(function(a){a.forEach((function(a){a.navigationId&&a.navigationId>o.navigationId&&(r||e(!0),s("soft-navigation",a.navigationId),e=m(n,o,i,t.reportAllChanges))}))})),setTimeout(e,0))},i=!1,function(n){i||(e(n),i=!0)}))}((function(t){!function(n){if(n.entries.length){var t=n.entries.reduce((function(n,t){return n&&n.value>t.value?n:t}));if(t&&t.sources&&t.sources.length){var e=(i=t.sources).find((function(n){return n.node&&1===n.node.nodeType}))||i[0];if(e)return void(n.attribution={largestShiftTarget:u(e.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:e,largestShiftEntry:t,loadState:o(t.startTime)})}}var i;n.attribution={}}(t),n(t)}),t)},F=function(n,t){A((function(t){!function(n){if(n.entries.length){var t,e=n.entries[n.entries.length-1],i=0,a=0;if(n.navigationId&&1!==n.navigationId?t=y(n.navigationId):(t=r())&&(i=t.activationStart||0,a=Math.max(0,t.responseStart-i)),t)return void(n.attribution={timeToFirstByte:a,firstByteToFCP:n.value-a,loadState:o(n.entries[0].startTime),navigationEntry:t,fcpEntry:e})}n.attribution={timeToFirstByte:0,firstByteToFCP:n.value,loadState:o(f())}}(t),n(t)}),t)},k={passive:!0,capture:!0},x=new Date,B=function(i,a){n||(n=a,t=i,e=new Date,N(removeEventListener),P())},P=function(){if(t>=0&&t<e-x){var a={entryType:"first-input",name:n.type,target:n.target,cancelable:n.cancelable,startTime:n.timeStamp,processingStart:n.timeStamp+t};i.forEach((function(n){n([a])})),i=[]}},D=function(n){if(n.cancelable){var t=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;"pointerdown"==n.type?function(n,t){var e=function(){B(n,t),a()},i=function(){a()},a=function(){removeEventListener("pointerup",e,k),removeEventListener("pointercancel",i,k)};addEventListener("pointerup",e,k),addEventListener("pointercancel",i,k)}(t,n):B(t,n)}},N=function(n){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return n(t,D,k)}))},R=function(e,a){var r=T(a=a||{});L((function(){var o,c=[100,300],u=w(),s=l("FID"),f=function(n){n.forEach((function(n){var t,i;r?(n.navigationId||1)>1&&(t="soft-navigation",i=n.navigationId,s=l("FID",0,t,i),o=m(e,s,c,a.reportAllChanges)):v.disconnect(),n.startTime<u.firstHiddenTime&&(s.value=n.processingStart-n.startTime,s.entries.push(n),s.navigationId=n.navigationId||1,o(!0))}))},v=g("first-input",f);o=m(e,s,c,a.reportAllChanges),v&&h((function(){f(v.takeRecords()),r||v.disconnect()})),v&&d((function(){var r;s=l("FID",0,"back-forward-cache",s.navigationId),o=m(e,s,c,a.reportAllChanges),i=[],t=-1,n=null,N(addEventListener),r=f,i.push(r),P()}))}))},q=function(n,t){R((function(t){!function(n){var t=n.entries[0];n.attribution={eventTarget:u(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:o(t.startTime)}}(t),n(t)}),t)},H=0,O=1/0,j=0,U=1,V=!1,_=function(n){n.forEach((function(n){n.interactionId&&(V&&n.navigationId&&n.navigationId>U&&(U=n.navigationId,H=0,O=1/0,j=0),O=Math.min(O,n.interactionId),j=Math.max(j,n.interactionId),H=j?(j-O)/7+1:0)}))},z=function(){return a?H:performance.interactionCount||0},G=function(n){"interactionCount"in performance||a||(V=n||!1,a=g("event",_,{type:"event",buffered:!0,durationThreshold:0}))},J=0,K=function(){return z()-J},Q=[],W={},X=function(n){var t=Q[Q.length-1],e=W[n.interactionId];if(e||Q.length<10||n.duration>t.latency){if(e)e.entries.push(n),e.latency=Math.max(e.latency,n.duration);else{var i={id:n.interactionId,latency:n.duration,entries:[n]};W[i.id]=i,Q.push(i)}Q.sort((function(n,t){return t.latency-n.latency})),Q.splice(10).forEach((function(n){delete W[n.id]}))}},Y=function(n,t){var e=T(t=t||{}),i=!1;L((function(){var a=[200,500];G(e);var r,o=l("INP"),c=function(e,c){Q=[],J="soft-navigation"===e?0:z(),o=l("INP",0,e,c),r=m(n,o,a,t.reportAllChanges),i=!1},u=function(){var n,e,i=(e=Math.min(Q.length-1,Math.floor(K()/50)),Q[e]);i&&(i.latency!==o.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(o.value=i.latency,o.entries=i.entries)},s=function(n){n.forEach((function(n){(e&&n.navigationId&&n.navigationId>o.navigationId&&(i||(u(),o.value>0&&r(!0)),c("soft-navigation",n.navigationId)),n.interactionId&&X(n),"first-input"===n.entryType)&&(!Q.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&X(n))})),u(),r()},f=g("event",s,{durationThreshold:t.durationThreshold||40});if(r=m(n,o,a,t.reportAllChanges),f){f.observe({type:"first-input",buffered:!0}),h((function(){s(f.takeRecords()),o.value<0&&K()>0&&(o.value=0,o.entries=[]),r(!0)})),d((function(){c("back-forward-cache",o.navigationId),p((function(){return r()}))}));e&&g("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&e.navigationId>o.navigationId&&(!i&&o.value>0&&r(!0),c("soft-navigation",e.navigationId),r=m(n,o,a,t.reportAllChanges))}))}))}}))},Z=function(n,t){Y((function(t){!function(n){if(n.entries.length){var t=n.entries.sort((function(n,t){return t.duration-n.duration||t.processingEnd-t.processingStart-(n.processingEnd-n.processingStart)}))[0];n.attribution={eventTarget:u(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:o(t.startTime)}}else n.attribution={}}(t),n(t)}),t)},$=function(n,t){!function(n,t){var e=!1,i=T(t=t||{});L((function(){var a,r=[2500,4e3],o=w(),c=l("LCP"),u=function(i,o){c=l("LCP",0,i,o),a=m(n,c,r,t.reportAllChanges),e=!1},s=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>c.navigationId&&(e||a(!0),u("soft-navigation",n.navigationId));var t,i=0;i=1!==n.navigationId&&n.navigationId?Math.max(n.startTime-((null===(t=y(n.navigationId))||void 0===t?void 0:t.startTime)||0),0):Math.max(n.startTime-v(),0),n.startTime<o.firstHiddenTime&&(c.value=i,c.entries=[n],c.navigationId=n.navigationId||1,a())}}))},f=function(){e||(s(T.takeRecords()),i||T.disconnect(),e=!0,a(!0))},T=g("largest-contentful-paint",s);T&&(a=m(n,c,r,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,f,!0)})),h(f),d((function(n){u("back-forward-cache",c.navigationId),p((function(){c.value=performance.now()-n.timeStamp,e=!0,a(!0)}))})),i&&g("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>c.navigationId&&(e||a(!0),u("soft-navigation",n.navigationId))}))})))}))}((function(t){!function(n){if(n.entries.length){var t,e=0,i=0;if(n.navigationId&&1!==n.navigationId?t=y():(t=r())&&(e=t.activationStart||0,i=t.responseStart||0),t){var a=n.entries[n.entries.length-1],o=a.url&&performance.getEntriesByType("resource").filter((function(n){return n.name===a.url}))[0],c=Math.max(0,i-e),s=Math.max(c,o?(o.requestStart||o.startTime)-e:0),f=Math.max(s,o?o.responseEnd-e:0),d=Math.max(f,a?a.startTime-e:0),v={element:u(a.element),timeToFirstByte:c,resourceLoadDelay:s-c,resourceLoadTime:f-s,elementRenderDelay:d-f,navigationEntry:t,lcpEntry:a};return a.url&&(v.url=a.url),o&&(v.lcpResourceEntry=o),void(n.attribution=v)}}n.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:n.value}}(t),n(t)}),t)},nn=function n(t){document.prerendering?L((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},tn=function(n,t){var e=T(t=t||{}),i=[800,1800],a=l("TTFB"),o=m(n,a,i,t.reportAllChanges);nn((function(){var c=r();if(c){var u=c.responseStart;if(u<=0||u>performance.now())return;a.value=Math.max(u-v(),0),a.entries=[c],o(!0),d((function(){a=l("TTFB",0,"back-forward-cache",a.navigationId),(o=m(n,a,i,t.reportAllChanges))(!0)}));e&&g("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&(a=l("TTFB",0,"soft-navigation",e.navigationId),(o=m(n,a,i,t.reportAllChanges))(!0))}))}))}}))},en=function(n,t){tn((function(t){!function(n){if(n.entries.length){var t=n.entries[0],e=t.activationStart||0,i=Math.max(t.domainLookupStart-e,0),a=Math.max(t.connectStart-e,0),r=Math.max(t.requestStart-e,0);n.attribution={waitingTime:i,dnsTime:a-i,connectionTime:r-a,requestTime:n.value-r,navigationEntry:t}}else n.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(t),n(t)}),t)};export{M as onCLS,F as onFCP,q as onFID,Z as onINP,$ as onLCP,en as onTTFB}; | ||
var n,t,e,i,a,r=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},o=function(n){if("loading"===document.readyState)return"loading";var t=r();if(t){if(n<t.domInteractive)return"loading";if(0===t.domContentLoadedEventStart||n<t.domContentLoadedEventStart)return"dom-interactive";if(0===t.domComplete||n<t.domComplete)return"dom-content-loaded"}return"complete"},c=function(n){var t=n.nodeName;return 1===n.nodeType?t.toLowerCase():t.toUpperCase().replace(/^#/,"")},u=function(n,t){var e="";try{for(;n&&9!==n.nodeType;){var i=n,a=i.id?"#"+i.id:c(i)+(i.className&&i.className.length?"."+i.className.replace(/\s+/g,"."):"");if(e.length+a.length>(t||100)-1)return e||a;if(e=e?a+">"+e:a,i.id)break;n=i.parentNode}}catch(n){}return e},s=-1,f=function(){return s},d=function(n){addEventListener("pageshow",(function(t){t.persisted&&(s=t.timeStamp,n(t))}),!0)},v=function(){var n=r();return n&&n.activationStart||0},l=function(n,t,e,i){var a=r(),o="navigate";return e?o=e:f()>=0?o="back-forward-cache":a&&(o=document.prerendering||v()>0?"prerender":document.wasDiscarded?"restore":a.type.replace(/_/g,"-")),{name:n,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:o,navigationId:i||1}},g=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},m=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},p=function(n,t,e){var i=g(e);try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var a=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return a.observe(Object.assign({type:n,buffered:!0,includeSoftNavigationObservations:i},e||{})),a}}catch(n){}},h=function(n,t,e,i){var a,r;return function(o){t.value>=0&&(o||i)&&((r=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=r,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,e),n(t))}},T=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},y=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},I=-1,E=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},S=function(n){"hidden"===document.visibilityState&&I>-1&&(I="visibilitychange"===n.type?n.timeStamp:0,C())},b=function(){addEventListener("visibilitychange",S,!0),addEventListener("prerenderingchange",S,!0)},C=function(){removeEventListener("visibilitychange",S,!0),removeEventListener("prerenderingchange",S,!0)},w=function(){return I<0&&(I=E(),b(),d((function(){setTimeout((function(){I=E(),b()}),0)}))),{get firstHiddenTime(){return I}}},L=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},A=function(n,t){var e=g(t=t||{});L((function(){var i,a=[1800,3e3],r=w(),o=l("FCP"),c=p("paint",(function(u){u.forEach((function(u){if("first-contentful-paint"===u.name){e?(u.navigationId||1)>1&&(g="soft-navigation",p=u.navigationId,o=l("FCP",0,g,p),i=h(n,o,a,t.reportAllChanges)):c.disconnect();var s=0;if(u.navigationId&&1!==u.navigationId){var f=m(u.navigationId),d=(null==f?void 0:f.startTime)||0;s=Math.max(u.startTime-d,0)}else s=Math.max(u.startTime-v(),0);(u.startTime<r.firstHiddenTime||u.navigationId&&u.navigationId>1)&&(o.value=s,o.entries.push(u),o.navigationId=u.navigationId||1,i(!0))}var g,p}))}));c&&(i=h(n,o,a,t.reportAllChanges),d((function(e){o=l("FCP",0,"back-forward-cache",o.navigationId),i=h(n,o,a,t.reportAllChanges),T((function(){o.value=performance.now()-e.timeStamp,i(!0)}))})))}))},M=function(n,t){!function(n,t){var e,i,a=g(t=t||{}),r=!1;A((e=function(){var e,i=[.1,.25],o=l("CLS",0),c=0,u=[],s=function(a,u){o=l("CLS",0,a,u),e=h(n,o,i,t.reportAllChanges),c=0,r=!1},f=function(n){n.forEach((function(n){if(a&&n.navigationId&&n.navigationId>o.navigationId&&(c>o.value&&(o.value=c,o.entries=u),e(!0),s("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=u[0],i=u[u.length-1];c&&n.startTime-i.startTime<1e3&&n.startTime-t.startTime<5e3?(c+=n.value,u.push(n)):(c=n.value,u=[n])}})),c>o.value&&(o.value=c,o.entries=u,e())},v=p("layout-shift",f);v&&(e=h(n,o,i,t.reportAllChanges),y((function(){f(v.takeRecords()),e(!0),r=!0})),d((function(){s("back-forward-cache",o.navigationId),T((function(){return e()}))})),a&&p("soft-navigation",(function(a){a.forEach((function(a){a.navigationId&&a.navigationId>o.navigationId&&(r||e(!0),s("soft-navigation",a.navigationId),e=h(n,o,i,t.reportAllChanges))}))})),setTimeout(e,0))},i=!1,function(n){i||(e(n),i=!0)}))}((function(t){!function(n){if(n.entries.length){var t=n.entries.reduce((function(n,t){return n&&n.value>t.value?n:t}));if(t&&t.sources&&t.sources.length){var e=(i=t.sources).find((function(n){return n.node&&1===n.node.nodeType}))||i[0];if(e)return void(n.attribution={largestShiftTarget:u(e.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:e,largestShiftEntry:t,loadState:o(t.startTime)})}}var i;n.attribution={}}(t),n(t)}),t)},F=function(n,t){A((function(t){!function(n){if(n.entries.length){var t,e=n.entries[n.entries.length-1],i=0,a=0;if(n.navigationId&&1!==n.navigationId?t=m(n.navigationId):(t=r())&&(i=t.activationStart||0,a=Math.max(0,t.responseStart-i)),t)return void(n.attribution={timeToFirstByte:a,firstByteToFCP:n.value-a,loadState:o(n.entries[0].startTime),navigationEntry:t,fcpEntry:e})}n.attribution={timeToFirstByte:0,firstByteToFCP:n.value,loadState:o(f())}}(t),n(t)}),t)},k={passive:!0,capture:!0},x=new Date,B=function(i,a){n||(n=a,t=i,e=new Date,N(removeEventListener),P())},P=function(){if(t>=0&&t<e-x){var a={entryType:"first-input",name:n.type,target:n.target,cancelable:n.cancelable,startTime:n.timeStamp,processingStart:n.timeStamp+t};i.forEach((function(n){n([a])})),i=[]}},D=function(n){if(n.cancelable){var t=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;"pointerdown"==n.type?function(n,t){var e=function(){B(n,t),a()},i=function(){a()},a=function(){removeEventListener("pointerup",e,k),removeEventListener("pointercancel",i,k)};addEventListener("pointerup",e,k),addEventListener("pointercancel",i,k)}(t,n):B(t,n)}},N=function(n){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return n(t,D,k)}))},R=function(e,a){var r=g(a=a||{});L((function(){var o,c=[100,300],u=w(),s=l("FID"),f=function(n){n.forEach((function(n){var t,i;r?(n.navigationId||1)>1&&(t="soft-navigation",i=n.navigationId,s=l("FID",0,t,i),o=h(e,s,c,a.reportAllChanges)):v.disconnect(),n.startTime<u.firstHiddenTime&&(s.value=n.processingStart-n.startTime,s.entries.push(n),s.navigationId=n.navigationId||1,o(!0))}))},v=p("first-input",f);o=h(e,s,c,a.reportAllChanges),v&&y((function(){f(v.takeRecords()),r||v.disconnect()})),v&&d((function(){var r;s=l("FID",0,"back-forward-cache",s.navigationId),o=h(e,s,c,a.reportAllChanges),i=[],t=-1,n=null,N(addEventListener),r=f,i.push(r),P()}))}))},q=function(n,t){R((function(t){!function(n){var t=n.entries[0];n.attribution={eventTarget:u(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:o(t.startTime)}}(t),n(t)}),t)},O=0,H=1/0,j=0,U=1,V=!1,_=function(n){n.forEach((function(n){n.interactionId&&(V&&n.navigationId&&n.navigationId>U&&(U=n.navigationId,O=0,H=1/0,j=0),H=Math.min(H,n.interactionId),j=Math.max(j,n.interactionId),O=j?(j-H)/7+1:0)}))},z=function(){return a?O:performance.interactionCount||0},G=function(n){"interactionCount"in performance||a||(V=n||!1,a=p("event",_,{type:"event",buffered:!0,durationThreshold:0,includeSoftNavigationObservations:n}))},J=0,K=function(){return z()-J},Q=[],W={},X=function(n){var t=Q[Q.length-1],e=W[n.interactionId];if(e||Q.length<10||n.duration>t.latency){if(e)e.entries.push(n),e.latency=Math.max(e.latency,n.duration);else{var i={id:n.interactionId,latency:n.duration,entries:[n]};W[i.id]=i,Q.push(i)}Q.sort((function(n,t){return t.latency-n.latency})),Q.splice(10).forEach((function(n){delete W[n.id]}))}},Y=function(n,t){var e=g(t=t||{}),i=!1;L((function(){var a=[200,500];G(e);var r,o=l("INP"),c=function(e,c){Q=[],J="soft-navigation"===e?0:z(),o=l("INP",0,e,c),r=h(n,o,a,t.reportAllChanges),i=!1},u=function(){var n,e,i=(e=Math.min(Q.length-1,Math.floor(K()/50)),Q[e]);i&&(i.latency!==o.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(o.value=i.latency,o.entries=i.entries)},s=function(n){n.forEach((function(n){(e&&n.navigationId&&n.navigationId>o.navigationId&&(i||(u(),o.value>0&&r(!0)),c("soft-navigation",n.navigationId)),n.interactionId&&X(n),"first-input"===n.entryType)&&(!Q.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&X(n))})),u(),r()},f=p("event",s,{durationThreshold:t.durationThreshold||40});if(r=h(n,o,a,t.reportAllChanges),f){f.observe({type:"first-input",buffered:!0}),y((function(){s(f.takeRecords()),o.value<0&&K()>0&&(o.value=0,o.entries=[]),r(!0)})),d((function(){c("back-forward-cache",o.navigationId),T((function(){return r()}))}));e&&p("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&e.navigationId>o.navigationId&&(!i&&o.value>0&&r(!0),c("soft-navigation",e.navigationId),r=h(n,o,a,t.reportAllChanges))}))}))}}))},Z=function(n,t){Y((function(t){!function(n){if(n.entries.length){var t=n.entries.sort((function(n,t){return t.duration-n.duration||t.processingEnd-t.processingStart-(n.processingEnd-n.processingStart)}))[0];n.attribution={eventTarget:u(t.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:o(t.startTime)}}else n.attribution={}}(t),n(t)}),t)},$=function(n,t){!function(n,t){var e=!1,i=g(t=t||{});L((function(){var a,r=[2500,4e3],o=w(),c=l("LCP"),u=function(i,o){c=l("LCP",0,i,o),a=h(n,c,r,t.reportAllChanges),e=!1},s=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>c.navigationId&&(e||a(!0),u("soft-navigation",n.navigationId));var t,i=0;i=1!==n.navigationId&&n.navigationId?Math.max(n.startTime-((null===(t=m(n.navigationId))||void 0===t?void 0:t.startTime)||0),0):Math.max(n.startTime-v(),0),n.startTime<o.firstHiddenTime&&(c.value=i,c.entries=[n],c.navigationId=n.navigationId||1,a())}}))},f=function(){e||(s(g.takeRecords()),i||g.disconnect(),e=!0,a(!0))},g=p("largest-contentful-paint",s);g&&(a=h(n,c,r,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,f,!0)})),y(f),d((function(n){u("back-forward-cache",c.navigationId),T((function(){c.value=performance.now()-n.timeStamp,e=!0,a(!0)}))})),i&&p("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>c.navigationId&&(e||a(!0),u("soft-navigation",n.navigationId))}))})))}))}((function(t){!function(n){if(n.entries.length){var t,e=0,i=0;if(n.navigationId&&1!==n.navigationId?t=m():(t=r())&&(e=t.activationStart||0,i=t.responseStart||0),t){var a=n.entries[n.entries.length-1],o=a.url&&performance.getEntriesByType("resource").filter((function(n){return n.name===a.url}))[0],c=Math.max(0,i-e),s=Math.max(c,o?(o.requestStart||o.startTime)-e:0),f=Math.max(s,o?o.responseEnd-e:0),d=Math.max(f,a?a.startTime-e:0),v={element:u(a.element),timeToFirstByte:c,resourceLoadDelay:s-c,resourceLoadTime:f-s,elementRenderDelay:d-f,navigationEntry:t,lcpEntry:a};return a.url&&(v.url=a.url),o&&(v.lcpResourceEntry=o),void(n.attribution=v)}}n.attribution={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadTime:0,elementRenderDelay:n.value}}(t),n(t)}),t)},nn=function n(t){document.prerendering?L((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},tn=function(n,t){var e=g(t=t||{}),i=[800,1800],a=l("TTFB"),o=h(n,a,i,t.reportAllChanges);nn((function(){var c=r();if(c){var u=c.responseStart;if(u<=0||u>performance.now())return;a.value=Math.max(u-v(),0),a.entries=[c],o(!0),d((function(){a=l("TTFB",0,"back-forward-cache",a.navigationId),(o=h(n,a,i,t.reportAllChanges))(!0)}));e&&p("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&(a=l("TTFB",0,"soft-navigation",e.navigationId),(o=h(n,a,i,t.reportAllChanges))(!0))}))}))}}))},en=function(n,t){tn((function(t){!function(n){if(n.entries.length){var t=n.entries[0],e=t.activationStart||0,i=Math.max(t.domainLookupStart-e,0),a=Math.max(t.connectStart-e,0),r=Math.max(t.requestStart-e,0);n.attribution={waitingTime:i,dnsTime:a-i,connectionTime:r-a,requestTime:n.value-r,navigationEntry:t}}else n.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(t),n(t)}),t)};export{M as onCLS,F as onFCP,q as onFID,Z as onINP,$ as onLCP,en as onTTFB}; |
@@ -1,1 +0,1 @@ | ||
!function(n){"use strict";var t,i=-1,e=function(n){addEventListener("pageshow",(function(t){t.persisted&&(i=t.timeStamp,n(t))}),!0)},a=function(){return window.performance&&(performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]||function(){var n=performance.timing,t=performance.navigation.type,i={entryType:"navigation",startTime:0,type:2==t?"back_forward":1===t?"reload":"navigate"};for(var e in n)"navigationStart"!==e&&"toJSON"!==e&&(i[e]=Math.max(n[e]-n.navigationStart,0));return i}())},o=function(){var n=a();return n&&n.activationStart||0},r=function(n,t,e,r){var c=a(),u="navigate";return e?u=e:i>=0?u="back-forward-cache":c&&(u=document.prerendering||o()>0?"prerender":document.wasDiscarded?"restore":c.type.replace(/_/g,"-")),{name:n,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:r||1}},c=function(n,t,i){try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var e=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return e.observe(Object.assign({type:n,buffered:!0},i||{})),e}}catch(n){}},u=function(n,t,i,e){var a,o;return function(r){t.value>=0&&(r||e)&&((o=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=o,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,i),n(t))}},f=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},d=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},s=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},v=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},g=-1,l=function(n){"hidden"===document.visibilityState&&g>-1&&(g="visibilitychange"===n.type?n.timeStamp:0,m())},p=function(){addEventListener("visibilitychange",l,!0),addEventListener("prerenderingchange",l,!0)},m=function(){removeEventListener("visibilitychange",l,!0),removeEventListener("prerenderingchange",l,!0)},h=function(){return g<0&&((g=window.webVitals.firstHiddenTime)===1/0&&p(),e((function(){setTimeout((function(){g="hidden"!==document.visibilityState||document.prerendering?1/0:0,p()}),0)}))),{get firstHiddenTime(){return g}}},I=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},y=function(n,t){var i=s(t=t||{});I((function(){var a,d=[1800,3e3],s=h(),g=r("FCP"),l=c("paint",(function(e){e.forEach((function(e){if("first-contentful-paint"===e.name){i?(e.navigationId||1)>1&&(m="soft-navigation",h=e.navigationId,g=r("FCP",0,m,h),a=u(n,g,d,t.reportAllChanges)):l.disconnect();var c=0;if(e.navigationId&&1!==e.navigationId){var f=v(e.navigationId),p=(null==f?void 0:f.startTime)||0;c=Math.max(e.startTime-p,0)}else c=Math.max(e.startTime-o(),0);(e.startTime<s.firstHiddenTime||e.navigationId&&e.navigationId>1)&&(g.value=c,g.entries.push(e),g.navigationId=e.navigationId||1,a(!0))}var m,h}))}));l&&(a=u(n,g,d,t.reportAllChanges),e((function(i){g=r("FCP",0,"back-forward-cache",g.navigationId),a=u(n,g,d,t.reportAllChanges),f((function(){g.value=performance.now()-i.timeStamp,a(!0)}))})))}))},T=function(n,t){var i,a,o=s(t=t||{}),v=!1;y((i=function(){var i,a=[.1,.25],s=r("CLS",0),g=0,l=[],p=function(e,o){s=r("CLS",0,e,o),i=u(n,s,a,t.reportAllChanges),g=0,v=!1},m=function(n){n.forEach((function(n){if(o&&n.navigationId&&n.navigationId>s.navigationId&&(g>s.value&&(s.value=g,s.entries=l),i(!0),p("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=l[0],e=l[l.length-1];g&&n.startTime-e.startTime<1e3&&n.startTime-t.startTime<5e3?(g+=n.value,l.push(n)):(g=n.value,l=[n])}})),g>s.value&&(s.value=g,s.entries=l,i())},h=c("layout-shift",m);h&&(i=u(n,s,a,t.reportAllChanges),d((function(){m(h.takeRecords()),i(!0),v=!0})),e((function(){p("back-forward-cache",s.navigationId),f((function(){return i()}))})),o&&c("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&e.navigationId>s.navigationId&&(v||i(!0),p("soft-navigation",e.navigationId),i=u(n,s,a,t.reportAllChanges))}))})),setTimeout(i,0))},a=!1,function(n){a||(i(n),a=!0)}))},w=function(n,t){var i=s(t=t||{});I((function(){var a,o=[100,300],f=h(),s=r("FID"),v=function(e){e.forEach((function(e){var c,d;i?(e.navigationId||1)>1&&(c="soft-navigation",d=e.navigationId,s=r("FID",0,c,d),a=u(n,s,o,t.reportAllChanges)):g.disconnect(),e.startTime<f.firstHiddenTime&&(s.value=e.processingStart-e.startTime,s.entries.push(e),s.navigationId=e.navigationId||1,a(!0))}))},g=c("first-input",v);a=u(n,s,o,t.reportAllChanges),g&&d((function(){v(g.takeRecords()),i||g.disconnect()})),console.warn('The web-vitals "base+polyfill" build is deprecated. See: https://bit.ly/3aqzsGm'),g||window.webVitals.firstInputPolyfill(v),e((function(){s=r("FID",0,"back-forward-cache",s.navigationId),a=u(n,s,o,t.reportAllChanges),window.webVitals.resetFirstInputPolyfill(),window.webVitals.firstInputPolyfill(v)}))}))},b=0,C=1/0,E=0,P=1,A=!1,S=function(n){n.forEach((function(n){n.interactionId&&(A&&n.navigationId&&n.navigationId>P&&(P=n.navigationId,b=0,C=1/0,E=0),C=Math.min(C,n.interactionId),E=Math.max(E,n.interactionId),b=E?(E-C)/7+1:0)}))},F=function(){return t?b:performance.interactionCount||0},L=function(n){"interactionCount"in performance||t||(A=n||!1,t=c("event",S,{type:"event",buffered:!0,durationThreshold:0}))},k=0,M=function(){return F()-k},B=[],x={},D=function(n){var t=B[B.length-1],i=x[n.interactionId];if(i||B.length<10||n.duration>t.latency){if(i)i.entries.push(n),i.latency=Math.max(i.latency,n.duration);else{var e={id:n.interactionId,latency:n.duration,entries:[n]};x[e.id]=e,B.push(e)}B.sort((function(n,t){return t.latency-n.latency})),B.splice(10).forEach((function(n){delete x[n.id]}))}},N=function(n,t){var i=s(t=t||{}),a=!1;I((function(){var o=[200,500];L(i);var s,v=r("INP"),g=function(i,e){B=[],k="soft-navigation"===i?0:F(),v=r("INP",0,i,e),s=u(n,v,o,t.reportAllChanges),a=!1},l=function(){var n,i,e=(i=Math.min(B.length-1,Math.floor(M()/50)),B[i]);e&&(e.latency!==v.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(v.value=e.latency,v.entries=e.entries)},p=function(n){n.forEach((function(n){(i&&n.navigationId&&n.navigationId>v.navigationId&&(a||(l(),v.value>0&&s(!0)),g("soft-navigation",n.navigationId)),n.interactionId&&D(n),"first-input"===n.entryType)&&(!B.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&D(n))})),l(),s()},m=c("event",p,{durationThreshold:t.durationThreshold||40});if(s=u(n,v,o,t.reportAllChanges),m){m.observe({type:"first-input",buffered:!0}),d((function(){p(m.takeRecords()),v.value<0&&M()>0&&(v.value=0,v.entries=[]),s(!0)})),e((function(){g("back-forward-cache",v.navigationId),f((function(){return s()}))}));i&&c("soft-navigation",(function(i){i.forEach((function(i){i.navigationId&&i.navigationId>v.navigationId&&(!a&&v.value>0&&s(!0),g("soft-navigation",i.navigationId),s=u(n,v,o,t.reportAllChanges))}))}))}}))},O=function(n,t){var i=!1,a=s(t=t||{});I((function(){var s,g=[2500,4e3],l=h(),p=r("LCP"),m=function(e,a){p=r("LCP",0,e,a),s=u(n,p,g,t.reportAllChanges),i=!1},I=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>p.navigationId&&(i||s(!0),m("soft-navigation",n.navigationId));var t,e=0;if(1!==n.navigationId&&n.navigationId)e=Math.max(n.startTime-((null===(t=v(n.navigationId))||void 0===t?void 0:t.startTime)||0),0);else e=Math.max(n.startTime-o(),0);n.startTime<l.firstHiddenTime&&(p.value=e,p.entries=[n],p.navigationId=n.navigationId||1,s())}}))},y=function(){i||(I(T.takeRecords()),a||T.disconnect(),i=!0,s(!0))},T=c("largest-contentful-paint",I);if(T){s=u(n,p,g,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,y,!0)})),d(y),e((function(n){m("back-forward-cache",p.navigationId),f((function(){p.value=performance.now()-n.timeStamp,i=!0,s(!0)}))}));a&&c("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>p.navigationId&&(i||s(!0),m("soft-navigation",n.navigationId))}))}))}}))},V=function n(t){document.prerendering?I((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},H=function(n,t){var i=s(t=t||{}),f=[800,1800],d=r("TTFB"),v=u(n,d,f,t.reportAllChanges);V((function(){var s=a();if(s){var g=s.responseStart;if(g<=0||g>performance.now())return;d.value=Math.max(g-o(),0),d.entries=[s],v(!0),e((function(){d=r("TTFB",0,"back-forward-cache",d.navigationId),(v=u(n,d,f,t.reportAllChanges))(!0)}));i&&c("soft-navigation",(function(i){i.forEach((function(i){i.navigationId&&(d=r("TTFB",0,"soft-navigation",i.navigationId),(v=u(n,d,f,t.reportAllChanges))(!0))}))}))}}))};n.getCLS=T,n.getFCP=y,n.getFID=w,n.getINP=N,n.getLCP=O,n.getTTFB=H,n.onCLS=T,n.onFCP=y,n.onFID=w,n.onINP=N,n.onLCP=O,n.onTTFB=H,Object.defineProperty(n,"__esModule",{value:!0})}(this.webVitals=this.webVitals||{}); | ||
!function(n){"use strict";var t,i=-1,e=function(n){addEventListener("pageshow",(function(t){t.persisted&&(i=t.timeStamp,n(t))}),!0)},a=function(){return window.performance&&(performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]||function(){var n=performance.timing,t=performance.navigation.type,i={entryType:"navigation",startTime:0,type:2==t?"back_forward":1===t?"reload":"navigate"};for(var e in n)"navigationStart"!==e&&"toJSON"!==e&&(i[e]=Math.max(n[e]-n.navigationStart,0));return i}())},o=function(){var n=a();return n&&n.activationStart||0},r=function(n,t,e,r){var c=a(),u="navigate";return e?u=e:i>=0?u="back-forward-cache":c&&(u=document.prerendering||o()>0?"prerender":document.wasDiscarded?"restore":c.type.replace(/_/g,"-")),{name:n,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:r||1}},c=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},u=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},f=function(n,t,i){var e=c(i);try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var a=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return a.observe(Object.assign({type:n,buffered:!0,includeSoftNavigationObservations:e},i||{})),a}}catch(n){}},d=function(n,t,i,e){var a,o;return function(r){t.value>=0&&(r||e)&&((o=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=o,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,i),n(t))}},s=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},v=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},g=-1,l=function(n){"hidden"===document.visibilityState&&g>-1&&(g="visibilitychange"===n.type?n.timeStamp:0,m())},p=function(){addEventListener("visibilitychange",l,!0),addEventListener("prerenderingchange",l,!0)},m=function(){removeEventListener("visibilitychange",l,!0),removeEventListener("prerenderingchange",l,!0)},h=function(){return g<0&&((g=window.webVitals.firstHiddenTime)===1/0&&p(),e((function(){setTimeout((function(){g="hidden"!==document.visibilityState||document.prerendering?1/0:0,p()}),0)}))),{get firstHiddenTime(){return g}}},I=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},y=function(n,t){var i=c(t=t||{});I((function(){var a,c=[1800,3e3],v=h(),g=r("FCP"),l=f("paint",(function(e){e.forEach((function(e){if("first-contentful-paint"===e.name){i?(e.navigationId||1)>1&&(m="soft-navigation",h=e.navigationId,g=r("FCP",0,m,h),a=d(n,g,c,t.reportAllChanges)):l.disconnect();var f=0;if(e.navigationId&&1!==e.navigationId){var s=u(e.navigationId),p=(null==s?void 0:s.startTime)||0;f=Math.max(e.startTime-p,0)}else f=Math.max(e.startTime-o(),0);(e.startTime<v.firstHiddenTime||e.navigationId&&e.navigationId>1)&&(g.value=f,g.entries.push(e),g.navigationId=e.navigationId||1,a(!0))}var m,h}))}));l&&(a=d(n,g,c,t.reportAllChanges),e((function(i){g=r("FCP",0,"back-forward-cache",g.navigationId),a=d(n,g,c,t.reportAllChanges),s((function(){g.value=performance.now()-i.timeStamp,a(!0)}))})))}))},T=function(n,t){var i,a,o=c(t=t||{}),u=!1;y((i=function(){var i,a=[.1,.25],c=r("CLS",0),g=0,l=[],p=function(e,o){c=r("CLS",0,e,o),i=d(n,c,a,t.reportAllChanges),g=0,u=!1},m=function(n){n.forEach((function(n){if(o&&n.navigationId&&n.navigationId>c.navigationId&&(g>c.value&&(c.value=g,c.entries=l),i(!0),p("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=l[0],e=l[l.length-1];g&&n.startTime-e.startTime<1e3&&n.startTime-t.startTime<5e3?(g+=n.value,l.push(n)):(g=n.value,l=[n])}})),g>c.value&&(c.value=g,c.entries=l,i())},h=f("layout-shift",m);h&&(i=d(n,c,a,t.reportAllChanges),v((function(){m(h.takeRecords()),i(!0),u=!0})),e((function(){p("back-forward-cache",c.navigationId),s((function(){return i()}))})),o&&f("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&e.navigationId>c.navigationId&&(u||i(!0),p("soft-navigation",e.navigationId),i=d(n,c,a,t.reportAllChanges))}))})),setTimeout(i,0))},a=!1,function(n){a||(i(n),a=!0)}))},w=function(n,t){var i=c(t=t||{});I((function(){var a,o=[100,300],c=h(),u=r("FID"),s=function(e){e.forEach((function(e){var f,s;i?(e.navigationId||1)>1&&(f="soft-navigation",s=e.navigationId,u=r("FID",0,f,s),a=d(n,u,o,t.reportAllChanges)):g.disconnect(),e.startTime<c.firstHiddenTime&&(u.value=e.processingStart-e.startTime,u.entries.push(e),u.navigationId=e.navigationId||1,a(!0))}))},g=f("first-input",s);a=d(n,u,o,t.reportAllChanges),g&&v((function(){s(g.takeRecords()),i||g.disconnect()})),console.warn('The web-vitals "base+polyfill" build is deprecated. See: https://bit.ly/3aqzsGm'),g||window.webVitals.firstInputPolyfill(s),e((function(){u=r("FID",0,"back-forward-cache",u.navigationId),a=d(n,u,o,t.reportAllChanges),window.webVitals.resetFirstInputPolyfill(),window.webVitals.firstInputPolyfill(s)}))}))},b=0,C=1/0,E=0,S=1,P=!1,A=function(n){n.forEach((function(n){n.interactionId&&(P&&n.navigationId&&n.navigationId>S&&(S=n.navigationId,b=0,C=1/0,E=0),C=Math.min(C,n.interactionId),E=Math.max(E,n.interactionId),b=E?(E-C)/7+1:0)}))},F=function(){return t?b:performance.interactionCount||0},L=function(n){"interactionCount"in performance||t||(P=n||!1,t=f("event",A,{type:"event",buffered:!0,durationThreshold:0,includeSoftNavigationObservations:n}))},k=0,M=function(){return F()-k},B=[],x={},N=function(n){var t=B[B.length-1],i=x[n.interactionId];if(i||B.length<10||n.duration>t.latency){if(i)i.entries.push(n),i.latency=Math.max(i.latency,n.duration);else{var e={id:n.interactionId,latency:n.duration,entries:[n]};x[e.id]=e,B.push(e)}B.sort((function(n,t){return t.latency-n.latency})),B.splice(10).forEach((function(n){delete x[n.id]}))}},O=function(n,t){var i=c(t=t||{}),a=!1;I((function(){var o=[200,500];L(i);var c,u=r("INP"),g=function(i,e){B=[],k="soft-navigation"===i?0:F(),u=r("INP",0,i,e),c=d(n,u,o,t.reportAllChanges),a=!1},l=function(){var n,i,e=(i=Math.min(B.length-1,Math.floor(M()/50)),B[i]);e&&(e.latency!==u.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(u.value=e.latency,u.entries=e.entries)},p=function(n){n.forEach((function(n){(i&&n.navigationId&&n.navigationId>u.navigationId&&(a||(l(),u.value>0&&c(!0)),g("soft-navigation",n.navigationId)),n.interactionId&&N(n),"first-input"===n.entryType)&&(!B.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&N(n))})),l(),c()},m=f("event",p,{durationThreshold:t.durationThreshold||40});if(c=d(n,u,o,t.reportAllChanges),m){m.observe({type:"first-input",buffered:!0}),v((function(){p(m.takeRecords()),u.value<0&&M()>0&&(u.value=0,u.entries=[]),c(!0)})),e((function(){g("back-forward-cache",u.navigationId),s((function(){return c()}))}));i&&f("soft-navigation",(function(i){i.forEach((function(i){i.navigationId&&i.navigationId>u.navigationId&&(!a&&u.value>0&&c(!0),g("soft-navigation",i.navigationId),c=d(n,u,o,t.reportAllChanges))}))}))}}))},D=function(n,t){var i=!1,a=c(t=t||{});I((function(){var c,g=[2500,4e3],l=h(),p=r("LCP"),m=function(e,a){p=r("LCP",0,e,a),c=d(n,p,g,t.reportAllChanges),i=!1},I=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>p.navigationId&&(i||c(!0),m("soft-navigation",n.navigationId));var t,e=0;if(1!==n.navigationId&&n.navigationId)e=Math.max(n.startTime-((null===(t=u(n.navigationId))||void 0===t?void 0:t.startTime)||0),0);else e=Math.max(n.startTime-o(),0);n.startTime<l.firstHiddenTime&&(p.value=e,p.entries=[n],p.navigationId=n.navigationId||1,c())}}))},y=function(){i||(I(T.takeRecords()),a||T.disconnect(),i=!0,c(!0))},T=f("largest-contentful-paint",I);if(T){c=d(n,p,g,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,y,!0)})),v(y),e((function(n){m("back-forward-cache",p.navigationId),s((function(){p.value=performance.now()-n.timeStamp,i=!0,c(!0)}))}));a&&f("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>p.navigationId&&(i||c(!0),m("soft-navigation",n.navigationId))}))}))}}))},V=function n(t){document.prerendering?I((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},H=function(n,t){var i=c(t=t||{}),u=[800,1800],s=r("TTFB"),v=d(n,s,u,t.reportAllChanges);V((function(){var c=a();if(c){var g=c.responseStart;if(g<=0||g>performance.now())return;s.value=Math.max(g-o(),0),s.entries=[c],v(!0),e((function(){s=r("TTFB",0,"back-forward-cache",s.navigationId),(v=d(n,s,u,t.reportAllChanges))(!0)}));i&&f("soft-navigation",(function(i){i.forEach((function(i){i.navigationId&&(s=r("TTFB",0,"soft-navigation",i.navigationId),(v=d(n,s,u,t.reportAllChanges))(!0))}))}))}}))};n.getCLS=T,n.getFCP=y,n.getFID=w,n.getINP=O,n.getLCP=D,n.getTTFB=H,n.onCLS=T,n.onFCP=y,n.onFID=w,n.onINP=O,n.onLCP=D,n.onTTFB=H,Object.defineProperty(n,"__esModule",{value:!0})}(this.webVitals=this.webVitals||{}); |
@@ -1,1 +0,1 @@ | ||
var n,t=-1,i=function(n){addEventListener("pageshow",(function(i){i.persisted&&(t=i.timeStamp,n(i))}),!0)},e=function(){return window.performance&&(performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]||function(){var n=performance.timing,t=performance.navigation.type,i={entryType:"navigation",startTime:0,type:2==t?"back_forward":1===t?"reload":"navigate"};for(var e in n)"navigationStart"!==e&&"toJSON"!==e&&(i[e]=Math.max(n[e]-n.navigationStart,0));return i}())},a=function(){var n=e();return n&&n.activationStart||0},o=function(n,i,o,r){var c=e(),u="navigate";return o?u=o:t>=0?u="back-forward-cache":c&&(u=document.prerendering||a()>0?"prerender":document.wasDiscarded?"restore":c.type.replace(/_/g,"-")),{name:n,value:void 0===i?-1:i,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:r||1}},r=function(n,t,i){try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var e=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return e.observe(Object.assign({type:n,buffered:!0},i||{})),e}}catch(n){}},c=function(n,t,i,e){var a,o;return function(r){t.value>=0&&(r||e)&&((o=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=o,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,i),n(t))}},u=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},f=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},d=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},s=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},v=-1,g=function(n){"hidden"===document.visibilityState&&v>-1&&(v="visibilitychange"===n.type?n.timeStamp:0,p())},l=function(){addEventListener("visibilitychange",g,!0),addEventListener("prerenderingchange",g,!0)},p=function(){removeEventListener("visibilitychange",g,!0),removeEventListener("prerenderingchange",g,!0)},m=function(){return v<0&&((v=window.webVitals.firstHiddenTime)===1/0&&l(),i((function(){setTimeout((function(){v="hidden"!==document.visibilityState||document.prerendering?1/0:0,l()}),0)}))),{get firstHiddenTime(){return v}}},h=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},I=function(n,t){var e=d(t=t||{});h((function(){var f,d=[1800,3e3],v=m(),g=o("FCP"),l=r("paint",(function(i){i.forEach((function(i){if("first-contentful-paint"===i.name){e?(i.navigationId||1)>1&&(m="soft-navigation",h=i.navigationId,g=o("FCP",0,m,h),f=c(n,g,d,t.reportAllChanges)):l.disconnect();var r=0;if(i.navigationId&&1!==i.navigationId){var u=s(i.navigationId),p=(null==u?void 0:u.startTime)||0;r=Math.max(i.startTime-p,0)}else r=Math.max(i.startTime-a(),0);(i.startTime<v.firstHiddenTime||i.navigationId&&i.navigationId>1)&&(g.value=r,g.entries.push(i),g.navigationId=i.navigationId||1,f(!0))}var m,h}))}));l&&(f=c(n,g,d,t.reportAllChanges),i((function(i){g=o("FCP",0,"back-forward-cache",g.navigationId),f=c(n,g,d,t.reportAllChanges),u((function(){g.value=performance.now()-i.timeStamp,f(!0)}))})))}))},y=function(n,t){var e,a,s=d(t=t||{}),v=!1;I((e=function(){var e,a=[.1,.25],d=o("CLS",0),g=0,l=[],p=function(i,r){d=o("CLS",0,i,r),e=c(n,d,a,t.reportAllChanges),g=0,v=!1},m=function(n){n.forEach((function(n){if(s&&n.navigationId&&n.navigationId>d.navigationId&&(g>d.value&&(d.value=g,d.entries=l),e(!0),p("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=l[0],i=l[l.length-1];g&&n.startTime-i.startTime<1e3&&n.startTime-t.startTime<5e3?(g+=n.value,l.push(n)):(g=n.value,l=[n])}})),g>d.value&&(d.value=g,d.entries=l,e())},h=r("layout-shift",m);h&&(e=c(n,d,a,t.reportAllChanges),f((function(){m(h.takeRecords()),e(!0),v=!0})),i((function(){p("back-forward-cache",d.navigationId),u((function(){return e()}))})),s&&r("soft-navigation",(function(i){i.forEach((function(i){i.navigationId&&i.navigationId>d.navigationId&&(v||e(!0),p("soft-navigation",i.navigationId),e=c(n,d,a,t.reportAllChanges))}))})),setTimeout(e,0))},a=!1,function(n){a||(e(n),a=!0)}))},T=function(n,t){var e=d(t=t||{});h((function(){var a,u=[100,300],d=m(),s=o("FID"),v=function(i){i.forEach((function(i){var r,f;e?(i.navigationId||1)>1&&(r="soft-navigation",f=i.navigationId,s=o("FID",0,r,f),a=c(n,s,u,t.reportAllChanges)):g.disconnect(),i.startTime<d.firstHiddenTime&&(s.value=i.processingStart-i.startTime,s.entries.push(i),s.navigationId=i.navigationId||1,a(!0))}))},g=r("first-input",v);a=c(n,s,u,t.reportAllChanges),g&&f((function(){v(g.takeRecords()),e||g.disconnect()})),console.warn('The web-vitals "base+polyfill" build is deprecated. See: https://bit.ly/3aqzsGm'),g||window.webVitals.firstInputPolyfill(v),i((function(){s=o("FID",0,"back-forward-cache",s.navigationId),a=c(n,s,u,t.reportAllChanges),window.webVitals.resetFirstInputPolyfill(),window.webVitals.firstInputPolyfill(v)}))}))},w=0,b=1/0,E=0,C=1,A=!1,S=function(n){n.forEach((function(n){n.interactionId&&(A&&n.navigationId&&n.navigationId>C&&(C=n.navigationId,w=0,b=1/0,E=0),b=Math.min(b,n.interactionId),E=Math.max(E,n.interactionId),w=E?(E-b)/7+1:0)}))},P=function(){return n?w:performance.interactionCount||0},L=function(t){"interactionCount"in performance||n||(A=t||!1,n=r("event",S,{type:"event",buffered:!0,durationThreshold:0}))},F=0,k=function(){return P()-F},M=[],B={},x=function(n){var t=M[M.length-1],i=B[n.interactionId];if(i||M.length<10||n.duration>t.latency){if(i)i.entries.push(n),i.latency=Math.max(i.latency,n.duration);else{var e={id:n.interactionId,latency:n.duration,entries:[n]};B[e.id]=e,M.push(e)}M.sort((function(n,t){return t.latency-n.latency})),M.splice(10).forEach((function(n){delete B[n.id]}))}},D=function(n,t){var e=d(t=t||{}),a=!1;h((function(){var d=[200,500];L(e);var s,v=o("INP"),g=function(i,e){M=[],F="soft-navigation"===i?0:P(),v=o("INP",0,i,e),s=c(n,v,d,t.reportAllChanges),a=!1},l=function(){var n,i,e=(i=Math.min(M.length-1,Math.floor(k()/50)),M[i]);e&&(e.latency!==v.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(v.value=e.latency,v.entries=e.entries)},p=function(n){n.forEach((function(n){(e&&n.navigationId&&n.navigationId>v.navigationId&&(a||(l(),v.value>0&&s(!0)),g("soft-navigation",n.navigationId)),n.interactionId&&x(n),"first-input"===n.entryType)&&(!M.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&x(n))})),l(),s()},m=r("event",p,{durationThreshold:t.durationThreshold||40});if(s=c(n,v,d,t.reportAllChanges),m){m.observe({type:"first-input",buffered:!0}),f((function(){p(m.takeRecords()),v.value<0&&k()>0&&(v.value=0,v.entries=[]),s(!0)})),i((function(){g("back-forward-cache",v.navigationId),u((function(){return s()}))}));e&&r("soft-navigation",(function(i){i.forEach((function(i){i.navigationId&&i.navigationId>v.navigationId&&(!a&&v.value>0&&s(!0),g("soft-navigation",i.navigationId),s=c(n,v,d,t.reportAllChanges))}))}))}}))},H=function(n,t){var e=!1,v=d(t=t||{});h((function(){var d,g=[2500,4e3],l=m(),p=o("LCP"),h=function(i,a){p=o("LCP",0,i,a),d=c(n,p,g,t.reportAllChanges),e=!1},I=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>p.navigationId&&(e||d(!0),h("soft-navigation",n.navigationId));var t,i=0;if(1!==n.navigationId&&n.navigationId)i=Math.max(n.startTime-((null===(t=s(n.navigationId))||void 0===t?void 0:t.startTime)||0),0);else i=Math.max(n.startTime-a(),0);n.startTime<l.firstHiddenTime&&(p.value=i,p.entries=[n],p.navigationId=n.navigationId||1,d())}}))},y=function(){e||(I(T.takeRecords()),v||T.disconnect(),e=!0,d(!0))},T=r("largest-contentful-paint",I);if(T){d=c(n,p,g,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,y,!0)})),f(y),i((function(n){h("back-forward-cache",p.navigationId),u((function(){p.value=performance.now()-n.timeStamp,e=!0,d(!0)}))}));v&&r("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>p.navigationId&&(e||d(!0),h("soft-navigation",n.navigationId))}))}))}}))},N=function n(t){document.prerendering?h((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},O=function(n,t){var u=d(t=t||{}),f=[800,1800],s=o("TTFB"),v=c(n,s,f,t.reportAllChanges);N((function(){var d=e();if(d){var g=d.responseStart;if(g<=0||g>performance.now())return;s.value=Math.max(g-a(),0),s.entries=[d],v(!0),i((function(){s=o("TTFB",0,"back-forward-cache",s.navigationId),(v=c(n,s,f,t.reportAllChanges))(!0)}));u&&r("soft-navigation",(function(i){i.forEach((function(i){i.navigationId&&(s=o("TTFB",0,"soft-navigation",i.navigationId),(v=c(n,s,f,t.reportAllChanges))(!0))}))}))}}))};export{y as getCLS,I as getFCP,T as getFID,D as getINP,H as getLCP,O as getTTFB,y as onCLS,I as onFCP,T as onFID,D as onINP,H as onLCP,O as onTTFB}; | ||
var n,t=-1,i=function(n){addEventListener("pageshow",(function(i){i.persisted&&(t=i.timeStamp,n(i))}),!0)},e=function(){return window.performance&&(performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]||function(){var n=performance.timing,t=performance.navigation.type,i={entryType:"navigation",startTime:0,type:2==t?"back_forward":1===t?"reload":"navigate"};for(var e in n)"navigationStart"!==e&&"toJSON"!==e&&(i[e]=Math.max(n[e]-n.navigationStart,0));return i}())},a=function(){var n=e();return n&&n.activationStart||0},o=function(n,i,o,r){var c=e(),u="navigate";return o?u=o:t>=0?u="back-forward-cache":c&&(u=document.prerendering||a()>0?"prerender":document.wasDiscarded?"restore":c.type.replace(/_/g,"-")),{name:n,value:void 0===i?-1:i,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:u,navigationId:r||1}},r=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},c=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},u=function(n,t,i){var e=r(i);try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var a=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return a.observe(Object.assign({type:n,buffered:!0,includeSoftNavigationObservations:e},i||{})),a}}catch(n){}},f=function(n,t,i,e){var a,o;return function(r){t.value>=0&&(r||e)&&((o=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=o,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,i),n(t))}},d=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},s=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},v=-1,g=function(n){"hidden"===document.visibilityState&&v>-1&&(v="visibilitychange"===n.type?n.timeStamp:0,p())},l=function(){addEventListener("visibilitychange",g,!0),addEventListener("prerenderingchange",g,!0)},p=function(){removeEventListener("visibilitychange",g,!0),removeEventListener("prerenderingchange",g,!0)},m=function(){return v<0&&((v=window.webVitals.firstHiddenTime)===1/0&&l(),i((function(){setTimeout((function(){v="hidden"!==document.visibilityState||document.prerendering?1/0:0,l()}),0)}))),{get firstHiddenTime(){return v}}},h=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},I=function(n,t){var e=r(t=t||{});h((function(){var r,s=[1800,3e3],v=m(),g=o("FCP"),l=u("paint",(function(i){i.forEach((function(i){if("first-contentful-paint"===i.name){e?(i.navigationId||1)>1&&(m="soft-navigation",h=i.navigationId,g=o("FCP",0,m,h),r=f(n,g,s,t.reportAllChanges)):l.disconnect();var u=0;if(i.navigationId&&1!==i.navigationId){var d=c(i.navigationId),p=(null==d?void 0:d.startTime)||0;u=Math.max(i.startTime-p,0)}else u=Math.max(i.startTime-a(),0);(i.startTime<v.firstHiddenTime||i.navigationId&&i.navigationId>1)&&(g.value=u,g.entries.push(i),g.navigationId=i.navigationId||1,r(!0))}var m,h}))}));l&&(r=f(n,g,s,t.reportAllChanges),i((function(i){g=o("FCP",0,"back-forward-cache",g.navigationId),r=f(n,g,s,t.reportAllChanges),d((function(){g.value=performance.now()-i.timeStamp,r(!0)}))})))}))},y=function(n,t){var e,a,c=r(t=t||{}),v=!1;I((e=function(){var e,a=[.1,.25],r=o("CLS",0),g=0,l=[],p=function(i,c){r=o("CLS",0,i,c),e=f(n,r,a,t.reportAllChanges),g=0,v=!1},m=function(n){n.forEach((function(n){if(c&&n.navigationId&&n.navigationId>r.navigationId&&(g>r.value&&(r.value=g,r.entries=l),e(!0),p("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=l[0],i=l[l.length-1];g&&n.startTime-i.startTime<1e3&&n.startTime-t.startTime<5e3?(g+=n.value,l.push(n)):(g=n.value,l=[n])}})),g>r.value&&(r.value=g,r.entries=l,e())},h=u("layout-shift",m);h&&(e=f(n,r,a,t.reportAllChanges),s((function(){m(h.takeRecords()),e(!0),v=!0})),i((function(){p("back-forward-cache",r.navigationId),d((function(){return e()}))})),c&&u("soft-navigation",(function(i){i.forEach((function(i){i.navigationId&&i.navigationId>r.navigationId&&(v||e(!0),p("soft-navigation",i.navigationId),e=f(n,r,a,t.reportAllChanges))}))})),setTimeout(e,0))},a=!1,function(n){a||(e(n),a=!0)}))},T=function(n,t){var e=r(t=t||{});h((function(){var a,r=[100,300],c=m(),d=o("FID"),v=function(i){i.forEach((function(i){var u,s;e?(i.navigationId||1)>1&&(u="soft-navigation",s=i.navigationId,d=o("FID",0,u,s),a=f(n,d,r,t.reportAllChanges)):g.disconnect(),i.startTime<c.firstHiddenTime&&(d.value=i.processingStart-i.startTime,d.entries.push(i),d.navigationId=i.navigationId||1,a(!0))}))},g=u("first-input",v);a=f(n,d,r,t.reportAllChanges),g&&s((function(){v(g.takeRecords()),e||g.disconnect()})),console.warn('The web-vitals "base+polyfill" build is deprecated. See: https://bit.ly/3aqzsGm'),g||window.webVitals.firstInputPolyfill(v),i((function(){d=o("FID",0,"back-forward-cache",d.navigationId),a=f(n,d,r,t.reportAllChanges),window.webVitals.resetFirstInputPolyfill(),window.webVitals.firstInputPolyfill(v)}))}))},w=0,b=1/0,E=0,C=1,S=!1,A=function(n){n.forEach((function(n){n.interactionId&&(S&&n.navigationId&&n.navigationId>C&&(C=n.navigationId,w=0,b=1/0,E=0),b=Math.min(b,n.interactionId),E=Math.max(E,n.interactionId),w=E?(E-b)/7+1:0)}))},P=function(){return n?w:performance.interactionCount||0},L=function(t){"interactionCount"in performance||n||(S=t||!1,n=u("event",A,{type:"event",buffered:!0,durationThreshold:0,includeSoftNavigationObservations:t}))},F=0,k=function(){return P()-F},M=[],B={},x=function(n){var t=M[M.length-1],i=B[n.interactionId];if(i||M.length<10||n.duration>t.latency){if(i)i.entries.push(n),i.latency=Math.max(i.latency,n.duration);else{var e={id:n.interactionId,latency:n.duration,entries:[n]};B[e.id]=e,M.push(e)}M.sort((function(n,t){return t.latency-n.latency})),M.splice(10).forEach((function(n){delete B[n.id]}))}},N=function(n,t){var e=r(t=t||{}),a=!1;h((function(){var r=[200,500];L(e);var c,v=o("INP"),g=function(i,e){M=[],F="soft-navigation"===i?0:P(),v=o("INP",0,i,e),c=f(n,v,r,t.reportAllChanges),a=!1},l=function(){var n,i,e=(i=Math.min(M.length-1,Math.floor(k()/50)),M[i]);e&&(e.latency!==v.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(v.value=e.latency,v.entries=e.entries)},p=function(n){n.forEach((function(n){(e&&n.navigationId&&n.navigationId>v.navigationId&&(a||(l(),v.value>0&&c(!0)),g("soft-navigation",n.navigationId)),n.interactionId&&x(n),"first-input"===n.entryType)&&(!M.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&x(n))})),l(),c()},m=u("event",p,{durationThreshold:t.durationThreshold||40});if(c=f(n,v,r,t.reportAllChanges),m){m.observe({type:"first-input",buffered:!0}),s((function(){p(m.takeRecords()),v.value<0&&k()>0&&(v.value=0,v.entries=[]),c(!0)})),i((function(){g("back-forward-cache",v.navigationId),d((function(){return c()}))}));e&&u("soft-navigation",(function(i){i.forEach((function(i){i.navigationId&&i.navigationId>v.navigationId&&(!a&&v.value>0&&c(!0),g("soft-navigation",i.navigationId),c=f(n,v,r,t.reportAllChanges))}))}))}}))},O=function(n,t){var e=!1,v=r(t=t||{});h((function(){var r,g=[2500,4e3],l=m(),p=o("LCP"),h=function(i,a){p=o("LCP",0,i,a),r=f(n,p,g,t.reportAllChanges),e=!1},I=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>p.navigationId&&(e||r(!0),h("soft-navigation",n.navigationId));var t,i=0;if(1!==n.navigationId&&n.navigationId)i=Math.max(n.startTime-((null===(t=c(n.navigationId))||void 0===t?void 0:t.startTime)||0),0);else i=Math.max(n.startTime-a(),0);n.startTime<l.firstHiddenTime&&(p.value=i,p.entries=[n],p.navigationId=n.navigationId||1,r())}}))},y=function(){e||(I(T.takeRecords()),v||T.disconnect(),e=!0,r(!0))},T=u("largest-contentful-paint",I);if(T){r=f(n,p,g,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,y,!0)})),s(y),i((function(n){h("back-forward-cache",p.navigationId),d((function(){p.value=performance.now()-n.timeStamp,e=!0,r(!0)}))}));v&&u("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>p.navigationId&&(e||r(!0),h("soft-navigation",n.navigationId))}))}))}}))},D=function n(t){document.prerendering?h((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},H=function(n,t){var c=r(t=t||{}),d=[800,1800],s=o("TTFB"),v=f(n,s,d,t.reportAllChanges);D((function(){var r=e();if(r){var g=r.responseStart;if(g<=0||g>performance.now())return;s.value=Math.max(g-a(),0),s.entries=[r],v(!0),i((function(){s=o("TTFB",0,"back-forward-cache",s.navigationId),(v=f(n,s,d,t.reportAllChanges))(!0)}));c&&u("soft-navigation",(function(i){i.forEach((function(i){i.navigationId&&(s=o("TTFB",0,"soft-navigation",i.navigationId),(v=f(n,s,d,t.reportAllChanges))(!0))}))}))}}))};export{y as getCLS,I as getFCP,T as getFID,N as getINP,O as getLCP,H as getTTFB,y as onCLS,I as onFCP,T as onFID,N as onINP,O as onLCP,H as onTTFB}; |
@@ -1,1 +0,1 @@ | ||
var webVitals=function(n){"use strict";var t,e,i,a,o,r=-1,c=function(n){addEventListener("pageshow",(function(t){t.persisted&&(r=t.timeStamp,n(t))}),!0)},u=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},f=function(){var n=u();return n&&n.activationStart||0},d=function(n,t,e,i){var a=u(),o="navigate";return e?o=e:r>=0?o="back-forward-cache":a&&(o=document.prerendering||f()>0?"prerender":document.wasDiscarded?"restore":a.type.replace(/_/g,"-")),{name:n,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:o,navigationId:i||1}},v=function(n,t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var i=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return i.observe(Object.assign({type:n,buffered:!0},e||{})),i}}catch(n){}},s=function(n,t,e,i){var a,o;return function(r){t.value>=0&&(r||i)&&((o=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=o,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,e),n(t))}},g=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},l=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},p=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},m=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},h=-1,I=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},y=function(n){"hidden"===document.visibilityState&&h>-1&&(h="visibilitychange"===n.type?n.timeStamp:0,E())},T=function(){addEventListener("visibilitychange",y,!0),addEventListener("prerenderingchange",y,!0)},E=function(){removeEventListener("visibilitychange",y,!0),removeEventListener("prerenderingchange",y,!0)},C=function(){return h<0&&(h=I(),T(),c((function(){setTimeout((function(){h=I(),T()}),0)}))),{get firstHiddenTime(){return h}}},w=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},b=function(n,t){var e=p(t=t||{});w((function(){var i,a=[1800,3e3],o=C(),r=d("FCP"),u=v("paint",(function(c){c.forEach((function(c){if("first-contentful-paint"===c.name){e?(c.navigationId||1)>1&&(p="soft-navigation",h=c.navigationId,r=d("FCP",0,p,h),i=s(n,r,a,t.reportAllChanges)):u.disconnect();var v=0;if(c.navigationId&&1!==c.navigationId){var g=m(c.navigationId),l=(null==g?void 0:g.startTime)||0;v=Math.max(c.startTime-l,0)}else v=Math.max(c.startTime-f(),0);(c.startTime<o.firstHiddenTime||c.navigationId&&c.navigationId>1)&&(r.value=v,r.entries.push(c),r.navigationId=c.navigationId||1,i(!0))}var p,h}))}));u&&(i=s(n,r,a,t.reportAllChanges),c((function(e){r=d("FCP",0,"back-forward-cache",r.navigationId),i=s(n,r,a,t.reportAllChanges),g((function(){r.value=performance.now()-e.timeStamp,i(!0)}))})))}))},L=function(n,t){var e,i,a=p(t=t||{}),o=!1;b((e=function(){var e,i=[.1,.25],r=d("CLS",0),u=0,f=[],p=function(a,c){r=d("CLS",0,a,c),e=s(n,r,i,t.reportAllChanges),u=0,o=!1},m=function(n){n.forEach((function(n){if(a&&n.navigationId&&n.navigationId>r.navigationId&&(u>r.value&&(r.value=u,r.entries=f),e(!0),p("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=f[0],i=f[f.length-1];u&&n.startTime-i.startTime<1e3&&n.startTime-t.startTime<5e3?(u+=n.value,f.push(n)):(u=n.value,f=[n])}})),u>r.value&&(r.value=u,r.entries=f,e())},h=v("layout-shift",m);h&&(e=s(n,r,i,t.reportAllChanges),l((function(){m(h.takeRecords()),e(!0),o=!0})),c((function(){p("back-forward-cache",r.navigationId),g((function(){return e()}))})),a&&v("soft-navigation",(function(a){a.forEach((function(a){a.navigationId&&a.navigationId>r.navigationId&&(o||e(!0),p("soft-navigation",a.navigationId),e=s(n,r,i,t.reportAllChanges))}))})),setTimeout(e,0))},i=!1,function(n){i||(e(n),i=!0)}))},S={passive:!0,capture:!0},A=new Date,P=function(n,a){t||(t=a,e=n,i=new Date,M(removeEventListener),F())},F=function(){if(e>=0&&e<i-A){var n={entryType:"first-input",name:t.type,target:t.target,cancelable:t.cancelable,startTime:t.timeStamp,processingStart:t.timeStamp+e};a.forEach((function(t){t([n])})),a=[]}},k=function(n){if(n.cancelable){var t=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;"pointerdown"==n.type?function(n,t){var e=function(){P(n,t),a()},i=function(){a()},a=function(){removeEventListener("pointerup",e,S),removeEventListener("pointercancel",i,S)};addEventListener("pointerup",e,S),addEventListener("pointercancel",i,S)}(t,n):P(t,n)}},M=function(n){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return n(t,k,S)}))},B=function(n,i){var o=p(i=i||{});w((function(){var r,u=[100,300],f=C(),g=d("FID"),p=function(t){t.forEach((function(t){var e,a;o?(t.navigationId||1)>1&&(e="soft-navigation",a=t.navigationId,g=d("FID",0,e,a),r=s(n,g,u,i.reportAllChanges)):m.disconnect(),t.startTime<f.firstHiddenTime&&(g.value=t.processingStart-t.startTime,g.entries.push(t),g.navigationId=t.navigationId||1,r(!0))}))},m=v("first-input",p);r=s(n,g,u,i.reportAllChanges),m&&l((function(){p(m.takeRecords()),o||m.disconnect()})),m&&c((function(){var o;g=d("FID",0,"back-forward-cache",g.navigationId),r=s(n,g,u,i.reportAllChanges),a=[],e=-1,t=null,M(addEventListener),o=p,a.push(o),F()}))}))},D=0,x=1/0,N=0,O=1,R=!1,H=function(n){n.forEach((function(n){n.interactionId&&(R&&n.navigationId&&n.navigationId>O&&(O=n.navigationId,D=0,x=1/0,N=0),x=Math.min(x,n.interactionId),N=Math.max(N,n.interactionId),D=N?(N-x)/7+1:0)}))},_=function(){return o?D:performance.interactionCount||0},j=function(n){"interactionCount"in performance||o||(R=n||!1,o=v("event",H,{type:"event",buffered:!0,durationThreshold:0}))},q=0,V=function(){return _()-q},z=[],G={},J=function(n){var t=z[z.length-1],e=G[n.interactionId];if(e||z.length<10||n.duration>t.latency){if(e)e.entries.push(n),e.latency=Math.max(e.latency,n.duration);else{var i={id:n.interactionId,latency:n.duration,entries:[n]};G[i.id]=i,z.push(i)}z.sort((function(n,t){return t.latency-n.latency})),z.splice(10).forEach((function(n){delete G[n.id]}))}},K=function(n,t){var e=p(t=t||{}),i=!1;w((function(){var a=[200,500];j(e);var o,r=d("INP"),u=function(e,c){z=[],q="soft-navigation"===e?0:_(),r=d("INP",0,e,c),o=s(n,r,a,t.reportAllChanges),i=!1},f=function(){var n,e,i=(e=Math.min(z.length-1,Math.floor(V()/50)),z[e]);i&&(i.latency!==r.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(r.value=i.latency,r.entries=i.entries)},p=function(n){n.forEach((function(n){(e&&n.navigationId&&n.navigationId>r.navigationId&&(i||(f(),r.value>0&&o(!0)),u("soft-navigation",n.navigationId)),n.interactionId&&J(n),"first-input"===n.entryType)&&(!z.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&J(n))})),f(),o()},m=v("event",p,{durationThreshold:t.durationThreshold||40});if(o=s(n,r,a,t.reportAllChanges),m){m.observe({type:"first-input",buffered:!0}),l((function(){p(m.takeRecords()),r.value<0&&V()>0&&(r.value=0,r.entries=[]),o(!0)})),c((function(){u("back-forward-cache",r.navigationId),g((function(){return o()}))}));e&&v("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&e.navigationId>r.navigationId&&(!i&&r.value>0&&o(!0),u("soft-navigation",e.navigationId),o=s(n,r,a,t.reportAllChanges))}))}))}}))},Q=function(n,t){var e=!1,i=p(t=t||{});w((function(){var a,o=[2500,4e3],r=C(),u=d("LCP"),p=function(i,r){u=d("LCP",0,i,r),a=s(n,u,o,t.reportAllChanges),e=!1},h=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>u.navigationId&&(e||a(!0),p("soft-navigation",n.navigationId));var t,i=0;if(1!==n.navigationId&&n.navigationId)i=Math.max(n.startTime-((null===(t=m(n.navigationId))||void 0===t?void 0:t.startTime)||0),0);else i=Math.max(n.startTime-f(),0);n.startTime<r.firstHiddenTime&&(u.value=i,u.entries=[n],u.navigationId=n.navigationId||1,a())}}))},I=function(){e||(h(y.takeRecords()),i||y.disconnect(),e=!0,a(!0))},y=v("largest-contentful-paint",h);if(y){a=s(n,u,o,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,I,!0)})),l(I),c((function(n){p("back-forward-cache",u.navigationId),g((function(){u.value=performance.now()-n.timeStamp,e=!0,a(!0)}))}));i&&v("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>u.navigationId&&(e||a(!0),p("soft-navigation",n.navigationId))}))}))}}))},U=function n(t){document.prerendering?w((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},W=function(n,t){var e=p(t=t||{}),i=[800,1800],a=d("TTFB"),o=s(n,a,i,t.reportAllChanges);U((function(){var r=u();if(r){var g=r.responseStart;if(g<=0||g>performance.now())return;a.value=Math.max(g-f(),0),a.entries=[r],o(!0),c((function(){a=d("TTFB",0,"back-forward-cache",a.navigationId),(o=s(n,a,i,t.reportAllChanges))(!0)}));e&&v("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&(a=d("TTFB",0,"soft-navigation",e.navigationId),(o=s(n,a,i,t.reportAllChanges))(!0))}))}))}}))};return n.getCLS=L,n.getFCP=b,n.getFID=B,n.getINP=K,n.getLCP=Q,n.getTTFB=W,n.onCLS=L,n.onFCP=b,n.onFID=B,n.onINP=K,n.onLCP=Q,n.onTTFB=W,Object.defineProperty(n,"__esModule",{value:!0}),n}({}); | ||
var webVitals=function(n){"use strict";var t,e,i,a,o,r=-1,c=function(n){addEventListener("pageshow",(function(t){t.persisted&&(r=t.timeStamp,n(t))}),!0)},u=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},f=function(){var n=u();return n&&n.activationStart||0},v=function(n,t,e,i){var a=u(),o="navigate";return e?o=e:r>=0?o="back-forward-cache":a&&(o=document.prerendering||f()>0?"prerender":document.wasDiscarded?"restore":a.type.replace(/_/g,"-")),{name:n,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:o,navigationId:i||1}},d=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},s=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},g=function(n,t,e){var i=d(e);try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var a=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return a.observe(Object.assign({type:n,buffered:!0,includeSoftNavigationObservations:i},e||{})),a}}catch(n){}},l=function(n,t,e,i){var a,o;return function(r){t.value>=0&&(r||i)&&((o=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=o,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,e),n(t))}},p=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},m=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},h=-1,I=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},y=function(n){"hidden"===document.visibilityState&&h>-1&&(h="visibilitychange"===n.type?n.timeStamp:0,E())},T=function(){addEventListener("visibilitychange",y,!0),addEventListener("prerenderingchange",y,!0)},E=function(){removeEventListener("visibilitychange",y,!0),removeEventListener("prerenderingchange",y,!0)},C=function(){return h<0&&(h=I(),T(),c((function(){setTimeout((function(){h=I(),T()}),0)}))),{get firstHiddenTime(){return h}}},b=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},w=function(n,t){var e=d(t=t||{});b((function(){var i,a=[1800,3e3],o=C(),r=v("FCP"),u=g("paint",(function(c){c.forEach((function(c){if("first-contentful-paint"===c.name){e?(c.navigationId||1)>1&&(m="soft-navigation",h=c.navigationId,r=v("FCP",0,m,h),i=l(n,r,a,t.reportAllChanges)):u.disconnect();var d=0;if(c.navigationId&&1!==c.navigationId){var g=s(c.navigationId),p=(null==g?void 0:g.startTime)||0;d=Math.max(c.startTime-p,0)}else d=Math.max(c.startTime-f(),0);(c.startTime<o.firstHiddenTime||c.navigationId&&c.navigationId>1)&&(r.value=d,r.entries.push(c),r.navigationId=c.navigationId||1,i(!0))}var m,h}))}));u&&(i=l(n,r,a,t.reportAllChanges),c((function(e){r=v("FCP",0,"back-forward-cache",r.navigationId),i=l(n,r,a,t.reportAllChanges),p((function(){r.value=performance.now()-e.timeStamp,i(!0)}))})))}))},L=function(n,t){var e,i,a=d(t=t||{}),o=!1;w((e=function(){var e,i=[.1,.25],r=v("CLS",0),u=0,f=[],d=function(a,c){r=v("CLS",0,a,c),e=l(n,r,i,t.reportAllChanges),u=0,o=!1},s=function(n){n.forEach((function(n){if(a&&n.navigationId&&n.navigationId>r.navigationId&&(u>r.value&&(r.value=u,r.entries=f),e(!0),d("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=f[0],i=f[f.length-1];u&&n.startTime-i.startTime<1e3&&n.startTime-t.startTime<5e3?(u+=n.value,f.push(n)):(u=n.value,f=[n])}})),u>r.value&&(r.value=u,r.entries=f,e())},h=g("layout-shift",s);h&&(e=l(n,r,i,t.reportAllChanges),m((function(){s(h.takeRecords()),e(!0),o=!0})),c((function(){d("back-forward-cache",r.navigationId),p((function(){return e()}))})),a&&g("soft-navigation",(function(a){a.forEach((function(a){a.navigationId&&a.navigationId>r.navigationId&&(o||e(!0),d("soft-navigation",a.navigationId),e=l(n,r,i,t.reportAllChanges))}))})),setTimeout(e,0))},i=!1,function(n){i||(e(n),i=!0)}))},S={passive:!0,capture:!0},A=new Date,P=function(n,a){t||(t=a,e=n,i=new Date,M(removeEventListener),F())},F=function(){if(e>=0&&e<i-A){var n={entryType:"first-input",name:t.type,target:t.target,cancelable:t.cancelable,startTime:t.timeStamp,processingStart:t.timeStamp+e};a.forEach((function(t){t([n])})),a=[]}},k=function(n){if(n.cancelable){var t=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;"pointerdown"==n.type?function(n,t){var e=function(){P(n,t),a()},i=function(){a()},a=function(){removeEventListener("pointerup",e,S),removeEventListener("pointercancel",i,S)};addEventListener("pointerup",e,S),addEventListener("pointercancel",i,S)}(t,n):P(t,n)}},M=function(n){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return n(t,k,S)}))},B=function(n,i){var o=d(i=i||{});b((function(){var r,u=[100,300],f=C(),d=v("FID"),s=function(t){t.forEach((function(t){var e,a;o?(t.navigationId||1)>1&&(e="soft-navigation",a=t.navigationId,d=v("FID",0,e,a),r=l(n,d,u,i.reportAllChanges)):p.disconnect(),t.startTime<f.firstHiddenTime&&(d.value=t.processingStart-t.startTime,d.entries.push(t),d.navigationId=t.navigationId||1,r(!0))}))},p=g("first-input",s);r=l(n,d,u,i.reportAllChanges),p&&m((function(){s(p.takeRecords()),o||p.disconnect()})),p&&c((function(){var o;d=v("FID",0,"back-forward-cache",d.navigationId),r=l(n,d,u,i.reportAllChanges),a=[],e=-1,t=null,M(addEventListener),o=s,a.push(o),F()}))}))},D=0,x=1/0,N=0,O=1,R=!1,H=function(n){n.forEach((function(n){n.interactionId&&(R&&n.navigationId&&n.navigationId>O&&(O=n.navigationId,D=0,x=1/0,N=0),x=Math.min(x,n.interactionId),N=Math.max(N,n.interactionId),D=N?(N-x)/7+1:0)}))},_=function(){return o?D:performance.interactionCount||0},j=function(n){"interactionCount"in performance||o||(R=n||!1,o=g("event",H,{type:"event",buffered:!0,durationThreshold:0,includeSoftNavigationObservations:n}))},q=0,V=function(){return _()-q},z=[],G={},J=function(n){var t=z[z.length-1],e=G[n.interactionId];if(e||z.length<10||n.duration>t.latency){if(e)e.entries.push(n),e.latency=Math.max(e.latency,n.duration);else{var i={id:n.interactionId,latency:n.duration,entries:[n]};G[i.id]=i,z.push(i)}z.sort((function(n,t){return t.latency-n.latency})),z.splice(10).forEach((function(n){delete G[n.id]}))}},K=function(n,t){var e=d(t=t||{}),i=!1;b((function(){var a=[200,500];j(e);var o,r=v("INP"),u=function(e,c){z=[],q="soft-navigation"===e?0:_(),r=v("INP",0,e,c),o=l(n,r,a,t.reportAllChanges),i=!1},f=function(){var n,e,i=(e=Math.min(z.length-1,Math.floor(V()/50)),z[e]);i&&(i.latency!==r.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(r.value=i.latency,r.entries=i.entries)},d=function(n){n.forEach((function(n){(e&&n.navigationId&&n.navigationId>r.navigationId&&(i||(f(),r.value>0&&o(!0)),u("soft-navigation",n.navigationId)),n.interactionId&&J(n),"first-input"===n.entryType)&&(!z.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&J(n))})),f(),o()},s=g("event",d,{durationThreshold:t.durationThreshold||40});if(o=l(n,r,a,t.reportAllChanges),s){s.observe({type:"first-input",buffered:!0}),m((function(){d(s.takeRecords()),r.value<0&&V()>0&&(r.value=0,r.entries=[]),o(!0)})),c((function(){u("back-forward-cache",r.navigationId),p((function(){return o()}))}));e&&g("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&e.navigationId>r.navigationId&&(!i&&r.value>0&&o(!0),u("soft-navigation",e.navigationId),o=l(n,r,a,t.reportAllChanges))}))}))}}))},Q=function(n,t){var e=!1,i=d(t=t||{});b((function(){var a,o=[2500,4e3],r=C(),u=v("LCP"),d=function(i,r){u=v("LCP",0,i,r),a=l(n,u,o,t.reportAllChanges),e=!1},h=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>u.navigationId&&(e||a(!0),d("soft-navigation",n.navigationId));var t,i=0;if(1!==n.navigationId&&n.navigationId)i=Math.max(n.startTime-((null===(t=s(n.navigationId))||void 0===t?void 0:t.startTime)||0),0);else i=Math.max(n.startTime-f(),0);n.startTime<r.firstHiddenTime&&(u.value=i,u.entries=[n],u.navigationId=n.navigationId||1,a())}}))},I=function(){e||(h(y.takeRecords()),i||y.disconnect(),e=!0,a(!0))},y=g("largest-contentful-paint",h);if(y){a=l(n,u,o,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,I,!0)})),m(I),c((function(n){d("back-forward-cache",u.navigationId),p((function(){u.value=performance.now()-n.timeStamp,e=!0,a(!0)}))}));i&&g("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>u.navigationId&&(e||a(!0),d("soft-navigation",n.navigationId))}))}))}}))},U=function n(t){document.prerendering?b((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},W=function(n,t){var e=d(t=t||{}),i=[800,1800],a=v("TTFB"),o=l(n,a,i,t.reportAllChanges);U((function(){var r=u();if(r){var d=r.responseStart;if(d<=0||d>performance.now())return;a.value=Math.max(d-f(),0),a.entries=[r],o(!0),c((function(){a=v("TTFB",0,"back-forward-cache",a.navigationId),(o=l(n,a,i,t.reportAllChanges))(!0)}));e&&g("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&(a=v("TTFB",0,"soft-navigation",e.navigationId),(o=l(n,a,i,t.reportAllChanges))(!0))}))}))}}))};return n.getCLS=L,n.getFCP=w,n.getFID=B,n.getINP=K,n.getLCP=Q,n.getTTFB=W,n.onCLS=L,n.onFCP=w,n.onFID=B,n.onINP=K,n.onLCP=Q,n.onTTFB=W,Object.defineProperty(n,"__esModule",{value:!0}),n}({}); |
@@ -1,1 +0,1 @@ | ||
var n,t,e,i,a,o=-1,r=function(n){addEventListener("pageshow",(function(t){t.persisted&&(o=t.timeStamp,n(t))}),!0)},c=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},u=function(){var n=c();return n&&n.activationStart||0},f=function(n,t,e,i){var a=c(),r="navigate";return e?r=e:o>=0?r="back-forward-cache":a&&(r=document.prerendering||u()>0?"prerender":document.wasDiscarded?"restore":a.type.replace(/_/g,"-")),{name:n,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r,navigationId:i||1}},d=function(n,t,e){try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var i=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return i.observe(Object.assign({type:n,buffered:!0},e||{})),i}}catch(n){}},v=function(n,t,e,i){var a,o;return function(r){t.value>=0&&(r||i)&&((o=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=o,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,e),n(t))}},s=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},g=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},l=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},p=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},m=-1,h=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},I=function(n){"hidden"===document.visibilityState&&m>-1&&(m="visibilitychange"===n.type?n.timeStamp:0,T())},y=function(){addEventListener("visibilitychange",I,!0),addEventListener("prerenderingchange",I,!0)},T=function(){removeEventListener("visibilitychange",I,!0),removeEventListener("prerenderingchange",I,!0)},E=function(){return m<0&&(m=h(),y(),r((function(){setTimeout((function(){m=h(),y()}),0)}))),{get firstHiddenTime(){return m}}},C=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},w=function(n,t){var e=l(t=t||{});C((function(){var i,a=[1800,3e3],o=E(),c=f("FCP"),g=d("paint",(function(r){r.forEach((function(r){if("first-contentful-paint"===r.name){e?(r.navigationId||1)>1&&(m="soft-navigation",h=r.navigationId,c=f("FCP",0,m,h),i=v(n,c,a,t.reportAllChanges)):g.disconnect();var d=0;if(r.navigationId&&1!==r.navigationId){var s=p(r.navigationId),l=(null==s?void 0:s.startTime)||0;d=Math.max(r.startTime-l,0)}else d=Math.max(r.startTime-u(),0);(r.startTime<o.firstHiddenTime||r.navigationId&&r.navigationId>1)&&(c.value=d,c.entries.push(r),c.navigationId=r.navigationId||1,i(!0))}var m,h}))}));g&&(i=v(n,c,a,t.reportAllChanges),r((function(e){c=f("FCP",0,"back-forward-cache",c.navigationId),i=v(n,c,a,t.reportAllChanges),s((function(){c.value=performance.now()-e.timeStamp,i(!0)}))})))}))},b=function(n,t){var e,i,a=l(t=t||{}),o=!1;w((e=function(){var e,i=[.1,.25],c=f("CLS",0),u=0,l=[],p=function(a,r){c=f("CLS",0,a,r),e=v(n,c,i,t.reportAllChanges),u=0,o=!1},m=function(n){n.forEach((function(n){if(a&&n.navigationId&&n.navigationId>c.navigationId&&(u>c.value&&(c.value=u,c.entries=l),e(!0),p("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=l[0],i=l[l.length-1];u&&n.startTime-i.startTime<1e3&&n.startTime-t.startTime<5e3?(u+=n.value,l.push(n)):(u=n.value,l=[n])}})),u>c.value&&(c.value=u,c.entries=l,e())},h=d("layout-shift",m);h&&(e=v(n,c,i,t.reportAllChanges),g((function(){m(h.takeRecords()),e(!0),o=!0})),r((function(){p("back-forward-cache",c.navigationId),s((function(){return e()}))})),a&&d("soft-navigation",(function(a){a.forEach((function(a){a.navigationId&&a.navigationId>c.navigationId&&(o||e(!0),p("soft-navigation",a.navigationId),e=v(n,c,i,t.reportAllChanges))}))})),setTimeout(e,0))},i=!1,function(n){i||(e(n),i=!0)}))},L={passive:!0,capture:!0},A=new Date,S=function(i,a){n||(n=a,t=i,e=new Date,P(removeEventListener),k())},k=function(){if(t>=0&&t<e-A){var a={entryType:"first-input",name:n.type,target:n.target,cancelable:n.cancelable,startTime:n.timeStamp,processingStart:n.timeStamp+t};i.forEach((function(n){n([a])})),i=[]}},F=function(n){if(n.cancelable){var t=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;"pointerdown"==n.type?function(n,t){var e=function(){S(n,t),a()},i=function(){a()},a=function(){removeEventListener("pointerup",e,L),removeEventListener("pointercancel",i,L)};addEventListener("pointerup",e,L),addEventListener("pointercancel",i,L)}(t,n):S(t,n)}},P=function(n){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return n(t,F,L)}))},M=function(e,a){var o=l(a=a||{});C((function(){var c,u=[100,300],s=E(),l=f("FID"),p=function(n){n.forEach((function(n){var t,i;o?(n.navigationId||1)>1&&(t="soft-navigation",i=n.navigationId,l=f("FID",0,t,i),c=v(e,l,u,a.reportAllChanges)):m.disconnect(),n.startTime<s.firstHiddenTime&&(l.value=n.processingStart-n.startTime,l.entries.push(n),l.navigationId=n.navigationId||1,c(!0))}))},m=d("first-input",p);c=v(e,l,u,a.reportAllChanges),m&&g((function(){p(m.takeRecords()),o||m.disconnect()})),m&&r((function(){var o;l=f("FID",0,"back-forward-cache",l.navigationId),c=v(e,l,u,a.reportAllChanges),i=[],t=-1,n=null,P(addEventListener),o=p,i.push(o),k()}))}))},B=0,D=1/0,x=0,R=1,H=!1,N=function(n){n.forEach((function(n){n.interactionId&&(H&&n.navigationId&&n.navigationId>R&&(R=n.navigationId,B=0,D=1/0,x=0),D=Math.min(D,n.interactionId),x=Math.max(x,n.interactionId),B=x?(x-D)/7+1:0)}))},O=function(){return a?B:performance.interactionCount||0},q=function(n){"interactionCount"in performance||a||(H=n||!1,a=d("event",N,{type:"event",buffered:!0,durationThreshold:0}))},j=0,_=function(){return O()-j},z=[],G={},J=function(n){var t=z[z.length-1],e=G[n.interactionId];if(e||z.length<10||n.duration>t.latency){if(e)e.entries.push(n),e.latency=Math.max(e.latency,n.duration);else{var i={id:n.interactionId,latency:n.duration,entries:[n]};G[i.id]=i,z.push(i)}z.sort((function(n,t){return t.latency-n.latency})),z.splice(10).forEach((function(n){delete G[n.id]}))}},K=function(n,t){var e=l(t=t||{}),i=!1;C((function(){var a=[200,500];q(e);var o,c=f("INP"),u=function(e,r){z=[],j="soft-navigation"===e?0:O(),c=f("INP",0,e,r),o=v(n,c,a,t.reportAllChanges),i=!1},l=function(){var n,e,i=(e=Math.min(z.length-1,Math.floor(_()/50)),z[e]);i&&(i.latency!==c.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(c.value=i.latency,c.entries=i.entries)},p=function(n){n.forEach((function(n){(e&&n.navigationId&&n.navigationId>c.navigationId&&(i||(l(),c.value>0&&o(!0)),u("soft-navigation",n.navigationId)),n.interactionId&&J(n),"first-input"===n.entryType)&&(!z.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&J(n))})),l(),o()},m=d("event",p,{durationThreshold:t.durationThreshold||40});if(o=v(n,c,a,t.reportAllChanges),m){m.observe({type:"first-input",buffered:!0}),g((function(){p(m.takeRecords()),c.value<0&&_()>0&&(c.value=0,c.entries=[]),o(!0)})),r((function(){u("back-forward-cache",c.navigationId),s((function(){return o()}))}));e&&d("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&e.navigationId>c.navigationId&&(!i&&c.value>0&&o(!0),u("soft-navigation",e.navigationId),o=v(n,c,a,t.reportAllChanges))}))}))}}))},Q=function(n,t){var e=!1,i=l(t=t||{});C((function(){var a,o=[2500,4e3],c=E(),l=f("LCP"),m=function(i,r){l=f("LCP",0,i,r),a=v(n,l,o,t.reportAllChanges),e=!1},h=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>l.navigationId&&(e||a(!0),m("soft-navigation",n.navigationId));var t,i=0;if(1!==n.navigationId&&n.navigationId)i=Math.max(n.startTime-((null===(t=p(n.navigationId))||void 0===t?void 0:t.startTime)||0),0);else i=Math.max(n.startTime-u(),0);n.startTime<c.firstHiddenTime&&(l.value=i,l.entries=[n],l.navigationId=n.navigationId||1,a())}}))},I=function(){e||(h(y.takeRecords()),i||y.disconnect(),e=!0,a(!0))},y=d("largest-contentful-paint",h);if(y){a=v(n,l,o,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,I,!0)})),g(I),r((function(n){m("back-forward-cache",l.navigationId),s((function(){l.value=performance.now()-n.timeStamp,e=!0,a(!0)}))}));i&&d("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>l.navigationId&&(e||a(!0),m("soft-navigation",n.navigationId))}))}))}}))},U=function n(t){document.prerendering?C((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},V=function(n,t){var e=l(t=t||{}),i=[800,1800],a=f("TTFB"),o=v(n,a,i,t.reportAllChanges);U((function(){var s=c();if(s){var g=s.responseStart;if(g<=0||g>performance.now())return;a.value=Math.max(g-u(),0),a.entries=[s],o(!0),r((function(){a=f("TTFB",0,"back-forward-cache",a.navigationId),(o=v(n,a,i,t.reportAllChanges))(!0)}));e&&d("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&(a=f("TTFB",0,"soft-navigation",e.navigationId),(o=v(n,a,i,t.reportAllChanges))(!0))}))}))}}))};export{b as getCLS,w as getFCP,M as getFID,K as getINP,Q as getLCP,V as getTTFB,b as onCLS,w as onFCP,M as onFID,K as onINP,Q as onLCP,V as onTTFB}; | ||
var n,t,e,i,a,o=-1,r=function(n){addEventListener("pageshow",(function(t){t.persisted&&(o=t.timeStamp,n(t))}),!0)},c=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},u=function(){var n=c();return n&&n.activationStart||0},f=function(n,t,e,i){var a=c(),r="navigate";return e?r=e:o>=0?r="back-forward-cache":a&&(r=document.prerendering||u()>0?"prerender":document.wasDiscarded?"restore":a.type.replace(/_/g,"-")),{name:n,value:void 0===t?-1:t,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r,navigationId:i||1}},v=function(n){return PerformanceObserver.supportedEntryTypes.includes("soft-navigation")&&(null==n?void 0:n.reportSoftNavs)},d=function(n){return n&&1!==n?window.performance&&performance.getEntriesByType&&performance.getEntriesByType("soft-navigation")[n-2]:window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},s=function(n,t,e){var i=v(e);try{if(PerformanceObserver.supportedEntryTypes.includes(n)){var a=new PerformanceObserver((function(n){Promise.resolve().then((function(){t(n.getEntries())}))}));return a.observe(Object.assign({type:n,buffered:!0,includeSoftNavigationObservations:i},e||{})),a}}catch(n){}},g=function(n,t,e,i){var a,o;return function(r){t.value>=0&&(r||i)&&((o=t.value-(a||0))||void 0===a)&&(a=t.value,t.delta=o,t.rating=function(n,t){return n>t[1]?"poor":n>t[0]?"needs-improvement":"good"}(t.value,e),n(t))}},l=function(n){requestAnimationFrame((function(){return requestAnimationFrame((function(){return n()}))}))},p=function(n){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||n(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},m=-1,h=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},I=function(n){"hidden"===document.visibilityState&&m>-1&&(m="visibilitychange"===n.type?n.timeStamp:0,T())},y=function(){addEventListener("visibilitychange",I,!0),addEventListener("prerenderingchange",I,!0)},T=function(){removeEventListener("visibilitychange",I,!0),removeEventListener("prerenderingchange",I,!0)},E=function(){return m<0&&(m=h(),y(),r((function(){setTimeout((function(){m=h(),y()}),0)}))),{get firstHiddenTime(){return m}}},C=function(n){document.prerendering?addEventListener("prerenderingchange",(function(){return n()}),!0):n()},w=function(n,t){var e=v(t=t||{});C((function(){var i,a=[1800,3e3],o=E(),c=f("FCP"),v=s("paint",(function(r){r.forEach((function(r){if("first-contentful-paint"===r.name){e?(r.navigationId||1)>1&&(m="soft-navigation",h=r.navigationId,c=f("FCP",0,m,h),i=g(n,c,a,t.reportAllChanges)):v.disconnect();var s=0;if(r.navigationId&&1!==r.navigationId){var l=d(r.navigationId),p=(null==l?void 0:l.startTime)||0;s=Math.max(r.startTime-p,0)}else s=Math.max(r.startTime-u(),0);(r.startTime<o.firstHiddenTime||r.navigationId&&r.navigationId>1)&&(c.value=s,c.entries.push(r),c.navigationId=r.navigationId||1,i(!0))}var m,h}))}));v&&(i=g(n,c,a,t.reportAllChanges),r((function(e){c=f("FCP",0,"back-forward-cache",c.navigationId),i=g(n,c,a,t.reportAllChanges),l((function(){c.value=performance.now()-e.timeStamp,i(!0)}))})))}))},b=function(n,t){var e,i,a=v(t=t||{}),o=!1;w((e=function(){var e,i=[.1,.25],c=f("CLS",0),u=0,v=[],d=function(a,r){c=f("CLS",0,a,r),e=g(n,c,i,t.reportAllChanges),u=0,o=!1},m=function(n){n.forEach((function(n){if(a&&n.navigationId&&n.navigationId>c.navigationId&&(u>c.value&&(c.value=u,c.entries=v),e(!0),d("soft-navigation",n.navigationId)),!n.hadRecentInput){var t=v[0],i=v[v.length-1];u&&n.startTime-i.startTime<1e3&&n.startTime-t.startTime<5e3?(u+=n.value,v.push(n)):(u=n.value,v=[n])}})),u>c.value&&(c.value=u,c.entries=v,e())},h=s("layout-shift",m);h&&(e=g(n,c,i,t.reportAllChanges),p((function(){m(h.takeRecords()),e(!0),o=!0})),r((function(){d("back-forward-cache",c.navigationId),l((function(){return e()}))})),a&&s("soft-navigation",(function(a){a.forEach((function(a){a.navigationId&&a.navigationId>c.navigationId&&(o||e(!0),d("soft-navigation",a.navigationId),e=g(n,c,i,t.reportAllChanges))}))})),setTimeout(e,0))},i=!1,function(n){i||(e(n),i=!0)}))},L={passive:!0,capture:!0},S=new Date,A=function(i,a){n||(n=a,t=i,e=new Date,P(removeEventListener),k())},k=function(){if(t>=0&&t<e-S){var a={entryType:"first-input",name:n.type,target:n.target,cancelable:n.cancelable,startTime:n.timeStamp,processingStart:n.timeStamp+t};i.forEach((function(n){n([a])})),i=[]}},F=function(n){if(n.cancelable){var t=(n.timeStamp>1e12?new Date:performance.now())-n.timeStamp;"pointerdown"==n.type?function(n,t){var e=function(){A(n,t),a()},i=function(){a()},a=function(){removeEventListener("pointerup",e,L),removeEventListener("pointercancel",i,L)};addEventListener("pointerup",e,L),addEventListener("pointercancel",i,L)}(t,n):A(t,n)}},P=function(n){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return n(t,F,L)}))},M=function(e,a){var o=v(a=a||{});C((function(){var c,u=[100,300],v=E(),d=f("FID"),l=function(n){n.forEach((function(n){var t,i;o?(n.navigationId||1)>1&&(t="soft-navigation",i=n.navigationId,d=f("FID",0,t,i),c=g(e,d,u,a.reportAllChanges)):m.disconnect(),n.startTime<v.firstHiddenTime&&(d.value=n.processingStart-n.startTime,d.entries.push(n),d.navigationId=n.navigationId||1,c(!0))}))},m=s("first-input",l);c=g(e,d,u,a.reportAllChanges),m&&p((function(){l(m.takeRecords()),o||m.disconnect()})),m&&r((function(){var o;d=f("FID",0,"back-forward-cache",d.navigationId),c=g(e,d,u,a.reportAllChanges),i=[],t=-1,n=null,P(addEventListener),o=l,i.push(o),k()}))}))},B=0,D=1/0,x=0,N=1,O=!1,R=function(n){n.forEach((function(n){n.interactionId&&(O&&n.navigationId&&n.navigationId>N&&(N=n.navigationId,B=0,D=1/0,x=0),D=Math.min(D,n.interactionId),x=Math.max(x,n.interactionId),B=x?(x-D)/7+1:0)}))},H=function(){return a?B:performance.interactionCount||0},q=function(n){"interactionCount"in performance||a||(O=n||!1,a=s("event",R,{type:"event",buffered:!0,durationThreshold:0,includeSoftNavigationObservations:n}))},j=0,_=function(){return H()-j},z=[],G={},J=function(n){var t=z[z.length-1],e=G[n.interactionId];if(e||z.length<10||n.duration>t.latency){if(e)e.entries.push(n),e.latency=Math.max(e.latency,n.duration);else{var i={id:n.interactionId,latency:n.duration,entries:[n]};G[i.id]=i,z.push(i)}z.sort((function(n,t){return t.latency-n.latency})),z.splice(10).forEach((function(n){delete G[n.id]}))}},K=function(n,t){var e=v(t=t||{}),i=!1;C((function(){var a=[200,500];q(e);var o,c=f("INP"),u=function(e,r){z=[],j="soft-navigation"===e?0:H(),c=f("INP",0,e,r),o=g(n,c,a,t.reportAllChanges),i=!1},v=function(){var n,e,i=(e=Math.min(z.length-1,Math.floor(_()/50)),z[e]);i&&(i.latency!==c.value||null!==(n=t)&&void 0!==n&&n.reportAllChanges)&&(c.value=i.latency,c.entries=i.entries)},d=function(n){n.forEach((function(n){(e&&n.navigationId&&n.navigationId>c.navigationId&&(i||(v(),c.value>0&&o(!0)),u("soft-navigation",n.navigationId)),n.interactionId&&J(n),"first-input"===n.entryType)&&(!z.some((function(t){return t.entries.some((function(t){return n.duration===t.duration&&n.startTime===t.startTime}))}))&&J(n))})),v(),o()},m=s("event",d,{durationThreshold:t.durationThreshold||40});if(o=g(n,c,a,t.reportAllChanges),m){m.observe({type:"first-input",buffered:!0}),p((function(){d(m.takeRecords()),c.value<0&&_()>0&&(c.value=0,c.entries=[]),o(!0)})),r((function(){u("back-forward-cache",c.navigationId),l((function(){return o()}))}));e&&s("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&e.navigationId>c.navigationId&&(!i&&c.value>0&&o(!0),u("soft-navigation",e.navigationId),o=g(n,c,a,t.reportAllChanges))}))}))}}))},Q=function(n,t){var e=!1,i=v(t=t||{});C((function(){var a,o=[2500,4e3],c=E(),v=f("LCP"),m=function(i,r){v=f("LCP",0,i,r),a=g(n,v,o,t.reportAllChanges),e=!1},h=function(n){n.forEach((function(n){if(n){n.navigationId&&n.navigationId>v.navigationId&&(e||a(!0),m("soft-navigation",n.navigationId));var t,i=0;if(1!==n.navigationId&&n.navigationId)i=Math.max(n.startTime-((null===(t=d(n.navigationId))||void 0===t?void 0:t.startTime)||0),0);else i=Math.max(n.startTime-u(),0);n.startTime<c.firstHiddenTime&&(v.value=i,v.entries=[n],v.navigationId=n.navigationId||1,a())}}))},I=function(){e||(h(y.takeRecords()),i||y.disconnect(),e=!0,a(!0))},y=s("largest-contentful-paint",h);if(y){a=g(n,v,o,t.reportAllChanges),["keydown","click"].forEach((function(n){addEventListener(n,I,!0)})),p(I),r((function(n){m("back-forward-cache",v.navigationId),l((function(){v.value=performance.now()-n.timeStamp,e=!0,a(!0)}))}));i&&s("soft-navigation",(function(n){n.forEach((function(n){n.navigationId&&n.navigationId>v.navigationId&&(e||a(!0),m("soft-navigation",n.navigationId))}))}))}}))},U=function n(t){document.prerendering?C((function(){return n(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return n(t)}),!0):setTimeout(t,0)},V=function(n,t){var e=v(t=t||{}),i=[800,1800],a=f("TTFB"),o=g(n,a,i,t.reportAllChanges);U((function(){var v=c();if(v){var d=v.responseStart;if(d<=0||d>performance.now())return;a.value=Math.max(d-u(),0),a.entries=[v],o(!0),r((function(){a=f("TTFB",0,"back-forward-cache",a.navigationId),(o=g(n,a,i,t.reportAllChanges))(!0)}));e&&s("soft-navigation",(function(e){e.forEach((function(e){e.navigationId&&(a=f("TTFB",0,"soft-navigation",e.navigationId),(o=g(n,a,i,t.reportAllChanges))(!0))}))}))}}))};export{b as getCLS,w as getFCP,M as getFID,K as getINP,Q as getLCP,V as getTTFB,b as onCLS,w as onFCP,M as onFID,K as onINP,Q as onLCP,V as onTTFB}; |
{ | ||
"name": "web-vitals", | ||
"version": "3.1.1-soft-navs-3", | ||
"version": "3.1.1-soft-navs-4", | ||
"description": "Easily measure performance metrics in JavaScript", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -21,2 +21,3 @@ /* | ||
} from '../types.js'; | ||
import {softNavs} from './softNavs.js'; | ||
@@ -47,2 +48,3 @@ interface PerformanceEntryMap { | ||
): PerformanceObserver | undefined => { | ||
const includeSoftNavigationObservations = softNavs(opts); | ||
try { | ||
@@ -63,2 +65,4 @@ if (PerformanceObserver.supportedEntryTypes.includes(type)) { | ||
buffered: true, | ||
includeSoftNavigationObservations: | ||
includeSoftNavigationObservations, | ||
}, | ||
@@ -65,0 +69,0 @@ opts || {} |
@@ -73,3 +73,4 @@ /* | ||
durationThreshold: 0, | ||
includeSoftNavigationObservations: softNavs, | ||
} as PerformanceObserverInit); | ||
}; |
@@ -81,2 +81,3 @@ /* | ||
durationThreshold?: number; | ||
includeSoftNavigationObservations?: boolean; | ||
} | ||
@@ -83,0 +84,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
428131
6860