{"version":3,"file":"web-vitals.attribution.umd.cjs","sources":["modules/lib/LayoutShiftManager.js","modules/lib/getNavigationEntry.js","modules/lib/getLoadState.js","modules/lib/getSelector.js","modules/lib/initUnique.js","modules/lib/bfcache.js","modules/lib/bindReporter.js","modules/lib/doubleRAF.js","modules/lib/getActivationStart.js","modules/lib/getVisibilityWatcher.js","modules/lib/initMetric.js","modules/lib/generateUniqueID.js","modules/lib/observe.js","modules/lib/softNavs.js","modules/lib/runOnce.js","modules/lib/FCPEntryManager.js","modules/lib/whenActivated.js","modules/onFCP.js","modules/onCLS.js","modules/attribution/onCLS.js","modules/lib/polyfills/interactionCountPolyfill.js","modules/lib/InteractionManager.js","modules/lib/whenIdleOrHidden.js","modules/onINP.js","modules/lib/LCPEntryManager.js","modules/onLCP.js","modules/onTTFB.js","modules/attribution/onFCP.js","modules/attribution/onINP.js","modules/attribution/onLCP.js","modules/attribution/onTTFB.js"],"sourcesContent":["/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport class LayoutShiftManager {\n    _onAfterProcessingUnexpectedShift;\n    _sessionValue = 0;\n    _sessionEntries = [];\n    _processEntry(entry) {\n        // Only count layout shifts without recent user input.\n        if (entry.hadRecentInput)\n            return;\n        const firstSessionEntry = this._sessionEntries[0];\n        const lastSessionEntry = this._sessionEntries.at(-1);\n        // If the entry occurred less than 1 second after the previous entry\n        // and less than 5 seconds after the first entry in the session,\n        // include the entry in the current session. Otherwise, start a new\n        // session.\n        if (this._sessionValue &&\n            firstSessionEntry &&\n            lastSessionEntry &&\n            entry.startTime - lastSessionEntry.startTime < 1000 &&\n            entry.startTime - firstSessionEntry.startTime < 5000) {\n            this._sessionValue += entry.value;\n            this._sessionEntries.push(entry);\n        }\n        else {\n            this._sessionValue = entry.value;\n            this._sessionEntries = [entry];\n        }\n        this._onAfterProcessingUnexpectedShift?.(entry);\n    }\n}\n//# sourceMappingURL=LayoutShiftManager.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const getNavigationEntry = () => {\n    const navigationEntry = performance.getEntriesByType('navigation')[0];\n    // Check to ensure the `responseStart` property is present and valid.\n    // In some cases a zero value is reported by the browser (for\n    // privacy/security reasons), and in other cases (bugs) the value is\n    // negative or is larger than the current page time. Ignore these cases:\n    // - https://github.com/GoogleChrome/web-vitals/issues/137\n    // - https://github.com/GoogleChrome/web-vitals/issues/162\n    // - https://github.com/GoogleChrome/web-vitals/issues/275\n    if (navigationEntry &&\n        navigationEntry.responseStart > 0 &&\n        navigationEntry.responseStart < performance.now()) {\n        return navigationEntry;\n    }\n};\n//# sourceMappingURL=getNavigationEntry.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { getNavigationEntry } from './getNavigationEntry.js';\nexport const getLoadState = (timestamp) => {\n    if (document.readyState === 'loading') {\n        // If the `readyState` is 'loading' there's no need to look at timestamps\n        // since the timestamp has to be the current time or earlier.\n        return 'loading';\n    }\n    const hardNavEntry = getNavigationEntry();\n    if (hardNavEntry) {\n        if (timestamp < hardNavEntry.domInteractive) {\n            return 'loading';\n        }\n        else if (hardNavEntry.domContentLoadedEventStart === 0 ||\n            timestamp < hardNavEntry.domContentLoadedEventStart) {\n            // If the `domContentLoadedEventStart` timestamp has not yet been\n            // set, or if the given timestamp is less than that value.\n            return 'dom-interactive';\n        }\n        else if (hardNavEntry.domComplete === 0 ||\n            timestamp < hardNavEntry.domComplete) {\n            // If the `domComplete` timestamp has not yet been\n            // set, or if the given timestamp is less than that value.\n            return 'dom-content-loaded';\n        }\n    }\n    // If any of the above fail, default to loaded. This could really only\n    // happy if the browser doesn't support the performance timeline, which\n    // most likely means this code would never run anyway.\n    return 'complete';\n};\n//# sourceMappingURL=getLoadState.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst getName = (node) => {\n    const name = node.nodeName;\n    return node.nodeType === 1\n        ? name.toLowerCase()\n        : name.toUpperCase().replace(/^#/, '');\n};\nconst MAX_LEN = 100;\nexport const getSelector = (node) => {\n    let sel = '';\n    try {\n        while (node?.nodeType !== 9) {\n            const el = node;\n            const part = el.id\n                ? '#' + el.id\n                : [getName(el), ...Array.from(el.classList ?? []).sort()].join('.');\n            if (sel.length + part.length > MAX_LEN - 1) {\n                return sel || part;\n            }\n            sel = sel ? part + '>' + sel : part;\n            if (el.id) {\n                break;\n            }\n            node = el.parentNode;\n        }\n    }\n    catch {\n        // Do nothing...\n    }\n    return sel;\n};\n//# sourceMappingURL=getSelector.js.map","/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst instanceMap = new WeakMap();\n/**\n * A function that accepts and identity object and a class object and returns\n * either a new instance of that class or an existing instance, if the\n * identity object was previously used.\n */\nexport function initUnique(identityObj, ClassObj) {\n    let classInstances = instanceMap.get(ClassObj);\n    if (!classInstances) {\n        classInstances = new WeakMap();\n        instanceMap.set(ClassObj, classInstances);\n    }\n    if (!classInstances.get(identityObj)) {\n        classInstances.set(identityObj, new ClassObj());\n    }\n    return classInstances.get(identityObj);\n}\n//# sourceMappingURL=initUnique.js.map","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nlet bfcacheRestoreTime = -1;\nexport const getBFCacheRestoreTime = () => bfcacheRestoreTime;\nexport const onBFCacheRestore = (cb) => {\n    addEventListener('pageshow', (event) => {\n        if (event.persisted) {\n            bfcacheRestoreTime = event.timeStamp;\n            cb(event);\n        }\n    }, true);\n};\n//# sourceMappingURL=bfcache.js.map","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst getRating = (value, thresholds) => {\n    if (value > thresholds[1]) {\n        return 'poor';\n    }\n    if (value > thresholds[0]) {\n        return 'needs-improvement';\n    }\n    return 'good';\n};\nexport const bindReporter = (callback, metric, thresholds, reportAllChanges) => {\n    let prevValue;\n    let delta;\n    return (forceReport) => {\n        if (metric.value >= 0) {\n            if (forceReport || reportAllChanges) {\n                delta = metric.value - (prevValue ?? 0);\n                // Report the metric if there's a non-zero delta or if no previous\n                // value exists (which can happen in the case of the document becoming\n                // hidden when the metric value is 0).\n                // See: https://github.com/GoogleChrome/web-vitals/issues/14\n                if (delta || prevValue === undefined) {\n                    prevValue = metric.value;\n                    metric.delta = delta;\n                    metric.rating = getRating(metric.value, thresholds);\n                    callback(metric);\n                }\n            }\n        }\n    };\n};\n//# sourceMappingURL=bindReporter.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const doubleRAF = (cb) => {\n    requestAnimationFrame(() => requestAnimationFrame(cb));\n};\n//# sourceMappingURL=doubleRAF.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { getNavigationEntry } from './getNavigationEntry.js';\nexport const getActivationStart = () => {\n    return getNavigationEntry()?.activationStart ?? 0;\n};\n//# sourceMappingURL=getActivationStart.js.map","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { onBFCacheRestore } from './bfcache.js';\nimport { getActivationStart } from './getActivationStart.js';\nlet firstHiddenTime = -1;\nconst onHiddenFunctions = new Set();\nconst initHiddenTime = () => {\n    // If the document is hidden when this code runs, assume it was always\n    // hidden and the page was loaded in the background, with the one exception\n    // that visibility state is always 'hidden' during prerendering, so we have\n    // to ignore that case until prerendering finishes (see: `prerenderingchange`\n    // event logic below).\n    return document.visibilityState === 'hidden' && !document.prerendering\n        ? 0\n        : Infinity;\n};\nconst onVisibilityUpdate = (event) => {\n    // Handle changes to hidden state\n    if (document.visibilityState === 'hidden') {\n        if (event.type === 'visibilitychange') {\n            for (const onHiddenFunction of onHiddenFunctions) {\n                onHiddenFunction();\n            }\n        }\n        // If the document is 'hidden' and no previous hidden timestamp has been\n        // set (so is infinity), update it based on the current event data.\n        if (!isFinite(firstHiddenTime)) {\n            // If the event is a 'visibilitychange' event, it means the page was\n            // visible prior to this change, so the event timestamp is the first\n            // hidden time.\n            // However, if the event is not a 'visibilitychange' event, then it must\n            // be a 'prerenderingchange' event, and the fact that the document is\n            // still 'hidden' from the above check means the tab was activated\n            // in a background state and so has always been hidden.\n            firstHiddenTime = event.type === 'visibilitychange' ? event.timeStamp : 0;\n            // We no longer need the `prerenderingchange` event listener now we've\n            // set an initial init time so remove that\n            // (we'll keep the visibilitychange one for onHiddenFunction above)\n            removeEventListener('prerenderingchange', onVisibilityUpdate, true);\n        }\n    }\n};\nexport const getVisibilityWatcher = (reset = false) => {\n    if (reset) {\n        firstHiddenTime = Infinity;\n    }\n    if (firstHiddenTime < 0) {\n        // Check if we have a previous hidden `visibility-state` performance entry.\n        const activationStart = getActivationStart();\n        /* eslint-disable indent */\n        const firstVisibilityStateHiddenTime = !document.prerendering\n            ? globalThis.performance\n                .getEntriesByType('visibility-state')\n                .find((e) => e.name === 'hidden' && e.startTime >= activationStart)\n                ?.startTime\n            : undefined;\n        /* eslint-enable indent */\n        // Prefer that, but if it's not available and the document is hidden when\n        // this code runs, assume it was hidden since navigation start. This isn't\n        // a perfect heuristic, but it's the best we can do until the\n        // `visibility-state` performance entry becomes available in all browsers.\n        firstHiddenTime = firstVisibilityStateHiddenTime ?? initHiddenTime();\n        // Listen for visibility changes so we can handle things like bfcache\n        // restores and/or prerender without having to examine individual\n        // timestamps in detail and also for onHidden function calls.\n        addEventListener('visibilitychange', onVisibilityUpdate, true);\n        // IMPORTANT: when a page is prerendering, its `visibilityState` is\n        // 'hidden', so in order to account for cases where this module checks for\n        // visibility during prerendering, an additional check after prerendering\n        // completes is also required.\n        addEventListener('prerenderingchange', onVisibilityUpdate, true);\n        // Reset the time on bfcache restores.\n        onBFCacheRestore(() => {\n            // Schedule a task in order to track the `visibilityState` once it's\n            // had an opportunity to change to visible in all browsers.\n            // https://bugs.chromium.org/p/chromium/issues/detail?id=1133363\n            setTimeout(() => {\n                firstHiddenTime = initHiddenTime();\n            });\n        });\n    }\n    return {\n        get firstHiddenTime() {\n            return firstHiddenTime;\n        },\n        onHidden(cb) {\n            onHiddenFunctions.add(cb);\n        },\n    };\n};\n//# sourceMappingURL=getVisibilityWatcher.js.map","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { getBFCacheRestoreTime } from './bfcache.js';\nimport { generateUniqueID } from './generateUniqueID.js';\nimport { getActivationStart } from './getActivationStart.js';\nimport { getNavigationEntry } from './getNavigationEntry.js';\nexport const initMetric = (name, value = -1, navigationType, navigationId = 0, navigationInteractionId, navigationURL, navigationStartTime) => {\n    const hardNavEntry = getNavigationEntry();\n    const hardNavId = hardNavEntry?.navigationId || 0;\n    let _navigationType = 'navigate';\n    if (navigationType) {\n        // If it was passed in, then use that\n        _navigationType = navigationType;\n    }\n    else if (getBFCacheRestoreTime() >= 0) {\n        _navigationType = 'back-forward-cache';\n    }\n    else if (hardNavEntry) {\n        if (document.prerendering || getActivationStart() > 0) {\n            _navigationType = 'prerender';\n        }\n        else if (document.wasDiscarded) {\n            _navigationType = 'restore';\n        }\n        else if (hardNavEntry.type) {\n            _navigationType = hardNavEntry.type.replace(/_/g, '-');\n        }\n    }\n    // Use `entries` type specific for the metric.\n    const entries = [];\n    return {\n        name,\n        value,\n        rating: 'good', // If needed, will be updated when reported. `const` to keep the type from widening to `string`.\n        delta: 0,\n        entries,\n        id: generateUniqueID(),\n        navigationType: _navigationType,\n        navigationId: navigationId || hardNavId,\n        navigationInteractionId: navigationInteractionId,\n        navigationURL: navigationURL || hardNavEntry?.name,\n        navigationStartTime: navigationStartTime || 0,\n    };\n};\n//# sourceMappingURL=initMetric.js.map","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Performantly generate a unique, 30-char string by combining a version\n * number, the current timestamp with a 13-digit number integer.\n * @return {string}\n */\nexport const generateUniqueID = () => {\n    return `v6-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`;\n};\n//# sourceMappingURL=generateUniqueID.js.map","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Takes a performance entry type and a callback function, and creates a\n * `PerformanceObserver` instance that will observe the specified entry type\n * with buffering enabled and call the callback _for each entry_.\n *\n * This function also feature-detects entry support and wraps the logic in a\n * try/catch to avoid errors in unsupporting browsers.\n */\nexport const observe = (types, callback, opts = {}) => {\n    try {\n        const supportedTypes = types.filter((t) => PerformanceObserver.supportedEntryTypes.includes(t));\n        if (supportedTypes.length > 0) {\n            const po = new PerformanceObserver((list) => {\n                // Delay by a microtask to workaround a bug in Safari where the\n                // callback is invoked immediately, rather than in a separate task.\n                // See: https://github.com/GoogleChrome/web-vitals/issues/277\n                queueMicrotask(() => {\n                    const entries = list.getEntries();\n                    // When observing more than one entry type, entries from different\n                    // types can be delivered out of order, so sort by end time\n                    // (startTime + duration) to ensure they're in the right order.\n                    // See: https://github.com/w3c/performance-timeline/issues/224\n                    if (supportedTypes.length > 1) {\n                        entries.sort((a, b) => {\n                            const scoreA = a.startTime + a.duration;\n                            const scoreB = b.startTime + b.duration;\n                            return scoreA - scoreB;\n                        });\n                    }\n                    callback(entries);\n                });\n            });\n            for (const t of supportedTypes) {\n                po.observe({ type: t, buffered: true, ...opts });\n            }\n            return po;\n        }\n    }\n    catch {\n        // Do nothing.\n    }\n    return;\n};\n//# sourceMappingURL=observe.js.map","/*\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const checkSoftNavsEnabled = (opts) => {\n    return (PerformanceObserver.supportedEntryTypes.includes('soft-navigation') &&\n        // Older implementations expose the value as an attribute rather than the\n        // method. We only support the newer method as that was what was launched\n        // to stable unflagged.\n        typeof globalThis.PerformanceSoftNavigation?.prototype\n            ?.getLargestInteractionContentfulPaint === 'function' &&\n        opts &&\n        opts.reportSoftNavs);\n};\n// Stores a soft navigation entry keyed by its navigationId, keeping only\n// the 2 most recent entries so the map cannot grow unbounded.\nexport const storeSoftNavEntry = (map, entry) => {\n    map.set(entry.navigationId, entry);\n    // Clean up older entries to prevent memory leaks, keeping only\n    // the 2 most recent entries.\n    if (map.size > 2) {\n        const firstKey = map.keys().next().value;\n        if (firstKey !== undefined) {\n            map.delete(firstKey);\n        }\n    }\n};\n//# sourceMappingURL=softNavs.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const runOnce = (cb) => {\n    let called = false;\n    return () => {\n        if (!called) {\n            cb();\n            called = true;\n        }\n    };\n};\n//# sourceMappingURL=runOnce.js.map","/*\n * Copyright 2026 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport class FCPEntryManager {\n    _softNavigationEntryMap;\n}\n//# sourceMappingURL=FCPEntryManager.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport const whenActivated = (callback) => {\n    if (document.prerendering) {\n        addEventListener('prerenderingchange', callback, true);\n    }\n    else {\n        callback();\n    }\n};\n//# sourceMappingURL=whenActivated.js.map","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { bindReporter } from './lib/bindReporter.js';\nimport { checkSoftNavsEnabled, storeSoftNavEntry } from './lib/softNavs.js';\nimport { doubleRAF } from './lib/doubleRAF.js';\nimport { getActivationStart } from './lib/getActivationStart.js';\nimport { getVisibilityWatcher } from './lib/getVisibilityWatcher.js';\nimport { initMetric } from './lib/initMetric.js';\nimport { initUnique } from './lib/initUnique.js';\nimport { FCPEntryManager } from './lib/FCPEntryManager.js';\nimport { observe } from './lib/observe.js';\nimport { getBFCacheRestoreTime, onBFCacheRestore } from './lib/bfcache.js';\nimport { whenActivated } from './lib/whenActivated.js';\n/** Thresholds for FCP. See https://web.dev/articles/fcp#what_is_a_good_fcp_score */\nexport const FCPThresholds = [1800, 3000];\n/**\n * Calculates the [FCP](https://web.dev/articles/fcp) value for the current page and\n * calls the `callback` function once the value is ready, along with the\n * relevant `paint` performance entry used to determine the value. The reported\n * value is a `DOMHighResTimeStamp`.\n */\nexport const onFCP = (onReport, opts = {}) => {\n    const softNavsEnabled = checkSoftNavsEnabled(opts);\n    whenActivated(() => {\n        // Create a new FCP entry manager for each page activation\n        // This allows us to track soft navigations separately\n        // needed when attribution is enabled.\n        const fcpEntryManager = initUnique(opts, FCPEntryManager);\n        const visibilityWatcher = getVisibilityWatcher();\n        let metric = initMetric('FCP');\n        let report;\n        const handleEntries = (entries) => {\n            for (const entry of entries) {\n                if (entry.name === 'first-contentful-paint') {\n                    po.disconnect();\n                    // Only report if the page wasn't hidden prior to FCP.\n                    if (entry.startTime < visibilityWatcher.firstHiddenTime) {\n                        // The activationStart reference is used because FCP should be\n                        // relative to page activation rather than navigation start if the\n                        // page was prerendered. But in cases where `activationStart` occurs\n                        // after the FCP, this time should be clamped at 0.\n                        metric.value = Math.max(entry.startTime - getActivationStart(), 0);\n                        metric.entries.push(entry);\n                        metric.navigationId = entry.navigationId || metric.navigationId;\n                        // FCP should only be reported once so can report right away\n                        report(true);\n                    }\n                }\n            }\n        };\n        const po = observe(['paint'], handleEntries);\n        if (po) {\n            report = bindReporter(onReport, metric, FCPThresholds, opts.reportAllChanges);\n            // Only report after a bfcache restore if the `PerformanceObserver`\n            // successfully registered or the `paint` entry exists.\n            onBFCacheRestore((event) => {\n                metric = initMetric('FCP', -1, 'back-forward-cache', metric.navigationId, metric.navigationInteractionId, metric.navigationURL, getBFCacheRestoreTime());\n                report = bindReporter(onReport, metric, FCPThresholds, opts.reportAllChanges);\n                doubleRAF(() => {\n                    metric.value = performance.now() - event.timeStamp;\n                    report(true);\n                });\n            });\n        }\n        if (softNavsEnabled) {\n            // As first-contentful-paint is only reported once, we can handle soft\n            // navigations afterwards on their own for simplicity, as no need to\n            // observe both and sort the entries like for the other metrics\n            const handleSoftNavEntries = (entries) => {\n                entries.forEach((entry) => {\n                    // Store the soft navigation entries in the entry manager so that\n                    // they can be retrieved for attribution if necessary. This code\n                    // is only used when attribution is enabled which sets the\n                    // _softNavigationEntryMap.\n                    if (fcpEntryManager._softNavigationEntryMap && entry.navigationId) {\n                        storeSoftNavEntry(fcpEntryManager._softNavigationEntryMap, entry);\n                    }\n                    // Clamp FCP at 0. It should never be less, but better safe than sorry.\n                    const FCPTime = Math.max((entry.presentationTime || entry.paintTime || 0) - entry.startTime, 0);\n                    metric = initMetric('FCP', FCPTime, 'soft-navigation', entry.navigationId, entry.interactionId, entry.name, entry.startTime);\n                    report = bindReporter(onReport, metric, FCPThresholds, opts.reportAllChanges);\n                    report(true);\n                });\n            };\n            observe(['soft-navigation'], handleSoftNavEntries, opts);\n        }\n    });\n};\n//# sourceMappingURL=onFCP.js.map","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { getBFCacheRestoreTime, onBFCacheRestore } from './lib/bfcache.js';\nimport { bindReporter } from './lib/bindReporter.js';\nimport { doubleRAF } from './lib/doubleRAF.js';\nimport { getVisibilityWatcher } from './lib/getVisibilityWatcher.js';\nimport { initMetric } from './lib/initMetric.js';\nimport { initUnique } from './lib/initUnique.js';\nimport { LayoutShiftManager } from './lib/LayoutShiftManager.js';\nimport { observe } from './lib/observe.js';\nimport { checkSoftNavsEnabled } from './lib/softNavs.js';\nimport { runOnce } from './lib/runOnce.js';\nimport { onFCP } from './onFCP.js';\n/** Thresholds for CLS. See https://web.dev/articles/cls#what_is_a_good_cls_score */\nexport const CLSThresholds = [0.1, 0.25];\n/**\n * Calculates the [CLS](https://web.dev/articles/cls) value for the current page and\n * calls the `callback` function once the value is ready to be reported, along\n * with all `layout-shift` performance entries that were used in the metric\n * value calculation. The reported value is a `double` (corresponding to a\n * [layout shift score](https://web.dev/articles/cls#layout_shift_score)).\n *\n * If the `reportAllChanges` configuration option is set to `true`, the\n * `callback` function will be called as soon as the value is initially\n * determined as well as any time the value changes throughout the page\n * lifespan.\n *\n * _**Important:** CLS should be continually monitored for changes throughout\n * the entire lifespan of a page—including if the user returns to the page after\n * it's been hidden/backgrounded. However, since browsers often [will not fire\n * additional callbacks once the user has backgrounded a\n * page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden),\n * `callback` is always called when the page's visibility state changes to\n * hidden. As a result, the `callback` function might be called multiple times\n * during the same page load._\n */\nexport const onCLS = (onReport, opts = {}) => {\n    const visibilityWatcher = getVisibilityWatcher();\n    // Start monitoring FCP so we can only report CLS if FCP is also reported.\n    // Note: this is done to match the current behavior of CrUX.\n    onFCP(runOnce(() => {\n        let metric = initMetric('CLS', 0);\n        let report;\n        const layoutShiftManager = initUnique(opts, LayoutShiftManager);\n        const initNewCLSMetric = (navigationType, navigationId, navigationInteractionId, navigationURL, navigationStartTime) => {\n            metric = initMetric('CLS', 0, navigationType, navigationId, navigationInteractionId, navigationURL, navigationStartTime);\n            layoutShiftManager._sessionValue = 0;\n            report = bindReporter(onReport, metric, CLSThresholds, opts.reportAllChanges);\n        };\n        const updateAndReportMetric = (forceReport = false) => {\n            // If the current session value is larger than the current CLS value,\n            // update CLS and the entries contributing to it.\n            if (layoutShiftManager._sessionValue > metric.value) {\n                metric.value = layoutShiftManager._sessionValue;\n                metric.entries = layoutShiftManager._sessionEntries;\n            }\n            report(forceReport);\n        };\n        const handleSoftNavEntry = (entry) => {\n            updateAndReportMetric(true);\n            initNewCLSMetric('soft-navigation', entry.navigationId, entry.interactionId, entry.name, entry.startTime);\n        };\n        const handleEntries = (entries) => {\n            for (const entry of entries) {\n                if (entry.entryType === 'soft-navigation') {\n                    handleSoftNavEntry(entry);\n                    continue;\n                }\n                layoutShiftManager._processEntry(entry);\n            }\n            updateAndReportMetric();\n        };\n        const types = ['layout-shift'];\n        if (checkSoftNavsEnabled(opts)) {\n            types.push('soft-navigation');\n        }\n        const po = observe(types, handleEntries);\n        if (po) {\n            report = bindReporter(onReport, metric, CLSThresholds, opts.reportAllChanges);\n            visibilityWatcher.onHidden(() => {\n                handleEntries(po.takeRecords());\n                report(true);\n            });\n            // Only report after a bfcache restore if the `PerformanceObserver`\n            // successfully registered.\n            onBFCacheRestore(() => {\n                initNewCLSMetric('back-forward-cache', metric.navigationId, metric.navigationInteractionId, metric.navigationURL, getBFCacheRestoreTime());\n                doubleRAF(report);\n            });\n            // Queue a task to report (if nothing else triggers a report first).\n            // This allows CLS to be reported as soon as FCP fires when\n            // `reportAllChanges` is true.\n            setTimeout(report);\n        }\n    }));\n};\n//# sourceMappingURL=onCLS.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { LayoutShiftManager } from '../lib/LayoutShiftManager.js';\nimport { getLoadState } from '../lib/getLoadState.js';\nimport { getSelector } from '../lib/getSelector.js';\nimport { initUnique } from '../lib/initUnique.js';\nimport { onCLS as unattributedOnCLS } from '../onCLS.js';\nconst getLargestLayoutShiftEntry = (entries) => {\n    return entries.reduce((a, b) => (a.value > b.value ? a : b));\n};\nconst getLargestLayoutShiftSource = (sources) => {\n    return sources.find((s) => s.node?.nodeType === 1) || sources[0];\n};\n/**\n * Calculates the [CLS](https://web.dev/articles/cls) value for the current page and\n * calls the `callback` function once the value is ready to be reported, along\n * with all `layout-shift` performance entries that were used in the metric\n * value calculation. The reported value is a `double` (corresponding to a\n * [layout shift score](https://web.dev/articles/cls#layout_shift_score)).\n *\n * If the `reportAllChanges` configuration option is set to `true`, the\n * `callback` function will be called as soon as the value is initially\n * determined as well as any time the value changes throughout the page\n * lifespan.\n *\n * _**Important:** CLS should be continually monitored for changes throughout\n * the entire lifespan of a page—including if the user returns to the page after\n * it's been hidden/backgrounded. However, since browsers often [will not fire\n * additional callbacks once the user has backgrounded a\n * page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden),\n * `callback` is always called when the page's visibility state changes to\n * hidden. As a result, the `callback` function might be called multiple times\n * during the same page load._\n */\nexport const onCLS = (onReport, opts = {}) => {\n    // Clone the opts object to ensure it's unique, so we can initialize a\n    // single instance of the `LayoutShiftManager` class that's shared only with\n    // this function invocation and the `unattributedOnCLS()` invocation below\n    // (which is passed the same `opts` object).\n    opts = Object.assign({}, opts);\n    const layoutShiftManager = initUnique(opts, LayoutShiftManager);\n    const layoutShiftTargetMap = new WeakMap();\n    layoutShiftManager._onAfterProcessingUnexpectedShift = (entry) => {\n        if (entry?.sources?.length) {\n            const largestSource = getLargestLayoutShiftSource(entry.sources);\n            const node = largestSource?.node;\n            if (node) {\n                const customTarget = opts.generateTarget?.(node) ?? getSelector(node);\n                layoutShiftTargetMap.set(largestSource, customTarget);\n            }\n        }\n    };\n    const attributeCLS = (metric) => {\n        // Use an empty object if no other attribution has been set.\n        let attribution = {};\n        if (metric.entries.length) {\n            const largestEntry = getLargestLayoutShiftEntry(metric.entries);\n            if (largestEntry?.sources?.length) {\n                const largestSource = getLargestLayoutShiftSource(largestEntry.sources);\n                if (largestSource) {\n                    attribution = {\n                        largestShiftTarget: layoutShiftTargetMap.get(largestSource),\n                        largestShiftTime: largestEntry.startTime,\n                        largestShiftValue: largestEntry.value,\n                        largestShiftSource: largestSource,\n                        largestShiftEntry: largestEntry,\n                        loadState: getLoadState(largestEntry.startTime),\n                    };\n                }\n            }\n        }\n        // Use `Object.assign()` to ensure the original metric object is returned.\n        return Object.assign(metric, { attribution });\n    };\n    unattributedOnCLS((metric) => {\n        onReport(attributeCLS(metric));\n    }, opts);\n};\n//# sourceMappingURL=onCLS.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { observe } from '../observe.js';\nlet interactionCountEstimate = 0;\nlet minKnownInteractionId = Infinity;\nlet maxKnownInteractionId = 0;\nconst updateEstimate = (entries) => {\n    for (const entry of entries) {\n        if (entry.interactionId) {\n            minKnownInteractionId = Math.min(minKnownInteractionId, entry.interactionId);\n            maxKnownInteractionId = Math.max(maxKnownInteractionId, entry.interactionId);\n            interactionCountEstimate = maxKnownInteractionId\n                ? (maxKnownInteractionId - minKnownInteractionId) / 7 + 1\n                : 0;\n        }\n    }\n};\nlet po;\n/**\n * Returns the `interactionCount` value using the native API (if available)\n * or the polyfill estimate in this module.\n */\nexport const getInteractionCount = () => {\n    return po ? interactionCountEstimate : (performance.interactionCount ?? 0);\n};\n/**\n * Feature detects native support or initializes the polyfill if needed.\n */\nexport const initInteractionCountPolyfill = () => {\n    if ('interactionCount' in performance || po)\n        return;\n    po = observe(['event'], updateEstimate, {\n        durationThreshold: 0,\n    });\n};\n//# sourceMappingURL=interactionCountPolyfill.js.map","/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { getInteractionCount } from './polyfills/interactionCountPolyfill.js';\n// To prevent unnecessary memory usage on pages with lots of interactions,\n// store at most 10 of the longest interactions to consider as INP candidates.\nconst MAX_INTERACTIONS_TO_CONSIDER = 10;\n// Used to store the interaction count after a bfcache restore, since p98\n// interaction latencies should only consider the current navigation.\nlet prevInteractionCount = 0;\n/**\n * Returns the interaction count since the last bfcache restore (or for the\n * full page lifecycle if there were no bfcache restores).\n */\nconst getInteractionCountForNavigation = () => {\n    return getInteractionCount() - prevInteractionCount;\n};\nexport class InteractionManager {\n    /**\n     * A list of longest interactions on the page (by latency) sorted so the\n     * longest one is first. The list is at most MAX_INTERACTIONS_TO_CONSIDER\n     * long.\n     */\n    _longestInteractionList = [];\n    /**\n     * A mapping of longest interactions by their interaction ID.\n     * This is used for faster lookup.\n     */\n    _longestInteractionMap = new Map();\n    _onBeforeProcessingEntry;\n    _onAfterProcessingINPCandidate;\n    _resetInteractions() {\n        prevInteractionCount = getInteractionCount();\n        this._longestInteractionList.length = 0;\n        this._longestInteractionMap.clear();\n    }\n    /**\n     * Returns the estimated p98 longest interaction based on the stored\n     * interaction candidates and the interaction count for the current page.\n     */\n    _estimateP98LongestInteraction(navigationType) {\n        const interactionCountForNavigation = getInteractionCountForNavigation();\n        const candidateInteractionIndex = Math.min(this._longestInteractionList.length - 1, Math.floor(interactionCountForNavigation / 50));\n        // If we have a non-zero interactionCountForNavigation but no\n        // candidateInteractionIndex, then it's below the 16ms limit\n        // so report a dummy 8ms interaction. This is only needed for\n        // soft-navs and bfcache restores as `first-input` handles the\n        // rest.\n        if (interactionCountForNavigation &&\n            candidateInteractionIndex === -1 &&\n            (navigationType === 'soft-navigation' ||\n                navigationType === 'back-forward-cache')) {\n            return {\n                _latency: 8,\n                id: -1,\n                entries: [],\n            };\n        }\n        return this._longestInteractionList[candidateInteractionIndex];\n    }\n    /**\n     * Takes a performance entry and adds it to the list of worst interactions\n     * if its duration is long enough to make it among the worst. If the\n     * entry is part of an existing interaction, it is merged and the latency\n     * and entries list is updated as needed.\n     */\n    _processEntry(entry) {\n        this._onBeforeProcessingEntry?.(entry);\n        // Skip further processing for entries that cannot be INP candidates.\n        if (!(entry.interactionId || entry.entryType === 'first-input'))\n            return;\n        // The least-long of the 10 longest interactions.\n        const minLongestInteraction = this._longestInteractionList.at(-1);\n        let interaction = this._longestInteractionMap.get(entry.interactionId);\n        // Only process the entry if it's possibly one of the ten longest,\n        // or if it's part of an existing interaction.\n        if (interaction ||\n            this._longestInteractionList.length < MAX_INTERACTIONS_TO_CONSIDER ||\n            // If the above conditions are false, `minLongestInteraction` will be set.\n            entry.duration > minLongestInteraction._latency) {\n            // If the interaction already exists, update it. Otherwise create one.\n            if (interaction) {\n                // If the new entry has a longer duration, replace the old entries,\n                // otherwise add to the array.\n                if (entry.duration > interaction._latency) {\n                    interaction.entries = [entry];\n                    interaction._latency = entry.duration;\n                }\n                else if (entry.duration === interaction._latency &&\n                    entry.startTime === interaction.entries[0].startTime) {\n                    interaction.entries.push(entry);\n                }\n            }\n            else {\n                interaction = {\n                    id: entry.interactionId,\n                    entries: [entry],\n                    _latency: entry.duration,\n                };\n                this._longestInteractionMap.set(interaction.id, interaction);\n                this._longestInteractionList.push(interaction);\n            }\n            // Sort the entries by latency (descending) and keep only the top ten.\n            this._longestInteractionList.sort((a, b) => b._latency - a._latency);\n            if (this._longestInteractionList.length > MAX_INTERACTIONS_TO_CONSIDER) {\n                const removedInteractions = this._longestInteractionList.splice(MAX_INTERACTIONS_TO_CONSIDER);\n                for (const interaction of removedInteractions) {\n                    this._longestInteractionMap.delete(interaction.id);\n                }\n            }\n            // Call any post-processing on the interaction\n            this._onAfterProcessingINPCandidate?.(interaction);\n        }\n    }\n}\n//# sourceMappingURL=InteractionManager.js.map","/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { runOnce } from './runOnce.js';\n/**\n * Runs the passed callback during the next idle period, or immediately\n * if the browser's visibility state is (or becomes) hidden.\n */\nexport const whenIdleOrHidden = (cb) => {\n    // Cap the requestIdleCallback to 1 sec for very busy apps\n    // https://github.com/GoogleChrome/web-vitals/issues/754\n    // If not using rIC, then the setTimeout timeout should be 0\n    const timeout = 'requestIdleCallback' in globalThis ? 1000 : 0;\n    const rIC = globalThis.requestIdleCallback || setTimeout;\n    const cIC = globalThis.cancelIdleCallback || clearTimeout;\n    // If the document is hidden, run the callback immediately, otherwise\n    // race an idle callback with the next `visibilitychange` event.\n    if (document.visibilityState === 'hidden') {\n        cb();\n    }\n    else {\n        const wrappedCb = runOnce(cb);\n        let idleHandle = -1;\n        const onHidden = () => {\n            cIC(idleHandle);\n            wrappedCb();\n        };\n        addEventListener('visibilitychange', onHidden, { once: true, capture: true });\n        idleHandle = rIC(() => {\n            removeEventListener('visibilitychange', onHidden, { capture: true });\n            wrappedCb();\n        }, { timeout: timeout });\n    }\n};\n//# sourceMappingURL=whenIdleOrHidden.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { getBFCacheRestoreTime, onBFCacheRestore } from './lib/bfcache.js';\nimport { bindReporter } from './lib/bindReporter.js';\nimport { initMetric } from './lib/initMetric.js';\nimport { initUnique } from './lib/initUnique.js';\nimport { InteractionManager } from './lib/InteractionManager.js';\nimport { observe } from './lib/observe.js';\nimport { checkSoftNavsEnabled } from './lib/softNavs.js';\nimport { initInteractionCountPolyfill } from './lib/polyfills/interactionCountPolyfill.js';\nimport { whenActivated } from './lib/whenActivated.js';\nimport { getVisibilityWatcher } from './lib/getVisibilityWatcher.js';\nimport { whenIdleOrHidden } from './lib/whenIdleOrHidden.js';\n/** Thresholds for INP. See https://web.dev/articles/inp#what_is_a_good_inp_score */\nexport const INPThresholds = [200, 500];\n// The default `durationThreshold` used across this library for observing\n// `event` entries via PerformanceObserver.\n// Event Timing entries have their durations rounded to the nearest 8ms,\n// so a duration of 40ms would be any event that spans 2.5 or more frames\n// at 60Hz. This threshold is chosen to strike a balance between usefulness\n// and performance. Running this callback for any interaction that spans\n// just one or two frames is likely not worth the insight that could be\n// gained.\nconst DEFAULT_DURATION_THRESHOLD = 40;\n/**\n * Calculates the [INP](https://web.dev/articles/inp) value for the current\n * page and calls the `callback` function once the value is ready, along with\n * the `event` performance entries reported for that interaction. The reported\n * value is a `DOMHighResTimeStamp`.\n *\n * A custom `durationThreshold` configuration option can optionally be passed\n * to control what `event-timing` entries are considered for INP reporting. The\n * default threshold is `40`, which means INP scores of less than 40 will not\n * be reported. To avoid reporting no interactions in these cases, the library\n * will fall back to the input delay of the first interaction. Note that this\n * will not affect your 75th percentile INP value unless that value is also\n * less than 40 (well below the recommended\n * [good](https://web.dev/articles/inp#what_is_a_good_inp_score) threshold).\n *\n * If the `reportAllChanges` configuration option is set to `true`, the\n * `callback` function will be called as soon as the value is initially\n * determined as well as any time the value changes throughout the page\n * lifespan.\n *\n * _**Important:** INP should be continually monitored for changes throughout\n * the entire lifespan of a page—including if the user returns to the page after\n * it's been hidden/backgrounded. However, since browsers often [will not fire\n * additional callbacks once the user has backgrounded a\n * page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden),\n * `callback` is always called when the page's visibility state changes to\n * hidden. As a result, the `callback` function might be called multiple times\n * during the same page load._\n */\nexport const onINP = (onReport, opts = {}) => {\n    // Return if the browser doesn't support all APIs needed to measure INP.\n    if (!(globalThis.PerformanceEventTiming &&\n        'interactionId' in PerformanceEventTiming.prototype)) {\n        return;\n    }\n    const visibilityWatcher = getVisibilityWatcher();\n    whenActivated(() => {\n        // TODO(philipwalton): remove once the polyfill is no longer needed.\n        initInteractionCountPolyfill();\n        let metric = initMetric('INP');\n        let report;\n        const interactionManager = initUnique(opts, InteractionManager);\n        const initNewINPMetric = (navigationType, navigationId, navigationInteractionId, navigationURL, navigationStartTime) => {\n            interactionManager._resetInteractions();\n            metric = initMetric('INP', -1, navigationType, navigationId, navigationInteractionId, navigationURL, navigationStartTime);\n            report = bindReporter(onReport, metric, INPThresholds, opts.reportAllChanges);\n        };\n        const updateINPMetric = () => {\n            const inp = interactionManager._estimateP98LongestInteraction(metric.navigationType);\n            if (inp && inp._latency !== metric.value) {\n                metric.value = inp._latency;\n                metric.entries = inp.entries;\n                report();\n            }\n        };\n        const handleSoftNavEntry = (entry) => {\n            updateINPMetric();\n            report(true);\n            initNewINPMetric('soft-navigation', entry.navigationId, entry.interactionId, entry.name, entry.startTime);\n        };\n        const handleEntries = (entries, forceReport = false) => {\n            // Queue the `handleEntries()` callback in the next idle task.\n            // This is needed to increase the chances that all event entries that\n            // occurred between the user interaction and the next paint\n            // have been dispatched. Note: there is currently an experiment\n            // running in Chrome (EventTimingKeypressAndCompositionInteractionId)\n            // 123+ that if rolled out fully may make this no longer necessary.\n            whenIdleOrHidden(() => {\n                for (const entry of entries) {\n                    if (entry.entryType === 'soft-navigation') {\n                        handleSoftNavEntry(entry);\n                        continue;\n                    }\n                    interactionManager._processEntry(entry);\n                }\n                updateINPMetric();\n                if (forceReport) {\n                    report(true);\n                }\n            });\n        };\n        const types = ['event', 'first-input'];\n        if (checkSoftNavsEnabled(opts)) {\n            types.push('soft-navigation');\n        }\n        const po = observe(types, handleEntries, {\n            ...opts,\n            durationThreshold: opts.durationThreshold ?? DEFAULT_DURATION_THRESHOLD,\n        });\n        report = bindReporter(onReport, metric, INPThresholds, opts.reportAllChanges);\n        if (po) {\n            visibilityWatcher.onHidden(() => {\n                handleEntries(po.takeRecords(), true);\n            });\n            // Only report after a bfcache restore if the `PerformanceObserver`\n            // successfully registered.\n            onBFCacheRestore(() => {\n                initNewINPMetric('back-forward-cache', metric.navigationId, metric.navigationInteractionId, metric.navigationURL, getBFCacheRestoreTime());\n            });\n        }\n    });\n};\n//# sourceMappingURL=onINP.js.map","/*\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport class LCPEntryManager {\n    _onBeforeProcessingEntry;\n    _softNavigationEntryMap;\n    _processEntry(entry) {\n        this._onBeforeProcessingEntry?.(entry);\n    }\n}\n//# sourceMappingURL=LCPEntryManager.js.map","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { LCPEntryManager } from './lib/LCPEntryManager.js';\nimport { getBFCacheRestoreTime, onBFCacheRestore } from './lib/bfcache.js';\nimport { bindReporter } from './lib/bindReporter.js';\nimport { doubleRAF } from './lib/doubleRAF.js';\nimport { getActivationStart } from './lib/getActivationStart.js';\nimport { checkSoftNavsEnabled, storeSoftNavEntry } from './lib/softNavs.js';\nimport { getVisibilityWatcher } from './lib/getVisibilityWatcher.js';\nimport { initMetric } from './lib/initMetric.js';\nimport { initUnique } from './lib/initUnique.js';\nimport { observe } from './lib/observe.js';\nimport { whenActivated } from './lib/whenActivated.js';\nimport { whenIdleOrHidden } from './lib/whenIdleOrHidden.js';\n/** Thresholds for LCP. See https://web.dev/articles/lcp#what_is_a_good_lcp_score */\nexport const LCPThresholds = [2500, 4000];\n/**\n * Calculates the [LCP](https://web.dev/articles/lcp) value for the current page and\n * calls the `callback` function once the value is ready (along with the\n * relevant `largest-contentful-paint` performance entry used to determine the\n * value). The reported value is a `DOMHighResTimeStamp`.\n *\n * If the `reportAllChanges` configuration option is set to `true`, the\n * `callback` function will be called any time a new `largest-contentful-paint`\n * performance entry is dispatched, or once the final value of the metric has\n * been determined.\n */\nexport const onLCP = (onReport, opts = {}) => {\n    // As InteractionContentfulPaint entries used by soft navs can emit after\n    // LCP is finalized, we need a flag to know to ignore them.\n    let isFinalized = false;\n    const softNavsEnabled = checkSoftNavsEnabled(opts);\n    whenActivated(() => {\n        let visibilityWatcher = getVisibilityWatcher();\n        let metric = initMetric('LCP');\n        let report;\n        const lcpEntryManager = initUnique(opts, LCPEntryManager);\n        const initNewLCPMetric = (navigation, navigationId, navigationInteractionId, navigationURL, navigationStartTime) => {\n            metric = initMetric('LCP', -1, navigation, navigationId, navigationInteractionId, navigationURL, navigationStartTime);\n            report = bindReporter(onReport, metric, LCPThresholds, opts.reportAllChanges);\n            // Reset the finalized flag\n            isFinalized = false;\n            // If it's a soft nav, then need to reset the visibilityWatcher\n            if (navigation === 'soft-navigation') {\n                visibilityWatcher = getVisibilityWatcher(true);\n            }\n        };\n        const handleSoftNavEntry = (entry) => {\n            if (lcpEntryManager._softNavigationEntryMap && entry.navigationId) {\n                storeSoftNavEntry(lcpEntryManager._softNavigationEntryMap, entry);\n            }\n            if (!isFinalized)\n                report(true);\n            initNewLCPMetric('soft-navigation', entry.navigationId, entry.interactionId, entry.name, entry.startTime);\n            // Soft Navs should contain the largest paint until now, so handle that\n            // as if it just happened, then listen for more.\n            // It can however be null in rare circumstances\n            // (see https://github.com/GoogleChrome/web-vitals/issues/725)\n            const largestInteractionContentfulPaint = entry.getLargestInteractionContentfulPaint?.();\n            if (largestInteractionContentfulPaint) {\n                handleEntries([largestInteractionContentfulPaint]);\n            }\n        };\n        const handleEntries = (entries) => {\n            // If reportAllChanges is set or soft navs is enabled then call this\n            // function for each entry, otherwise only consider the last one.\n            if (!opts.reportAllChanges && !softNavsEnabled) {\n                entries = entries.slice(-1);\n            }\n            for (const entry of entries) {\n                if (!entry)\n                    continue;\n                if (entry.entryType === 'soft-navigation') {\n                    handleSoftNavEntry(entry);\n                    continue;\n                }\n                let value = 0;\n                let metricEntries = [];\n                let renderTime = entry.startTime;\n                if (entry.entryType === 'largest-contentful-paint') {\n                    // The startTime attribute returns the value of the renderTime if it is\n                    // not 0, and the value of the loadTime otherwise. The activationStart\n                    // reference is used because LCP should be relative to page activation\n                    // rather than navigation start if the page was prerendered. But in cases\n                    // where `activationStart` occurs after the LCP, this time should be\n                    // clamped at 0.\n                    value = Math.max(entry.startTime - getActivationStart(), 0);\n                    lcpEntryManager._processEntry(entry);\n                    metricEntries = [entry];\n                }\n                else if (entry.entryType === 'interaction-contentful-paint') {\n                    const ICPEntry = entry;\n                    // InteractionContentfulPaints should only happen after a\n                    // PerformanceSoftNavigation so the metric should have been set\n                    // with a non-zero navigationId mapping to a soft nav.\n                    if (!metric.navigationId)\n                        continue;\n                    // Ignore interactions not for this soft nav\n                    // (either paints that have bled into this interaction or paints when\n                    // we should have already finalized)\n                    if ('interactionId' in ICPEntry &&\n                        ICPEntry.interactionId != metric.navigationInteractionId) {\n                        continue;\n                    }\n                    renderTime = ICPEntry.largestContentfulPaint?.renderTime || 0;\n                    // Paints should never be less than 0 but add cap just in case\n                    value = Math.max(renderTime - entry.startTime, 0);\n                    if (ICPEntry.largestContentfulPaint) {\n                        lcpEntryManager._processEntry(ICPEntry.largestContentfulPaint);\n                        metricEntries = [ICPEntry.largestContentfulPaint];\n                    }\n                }\n                // Only report if the page wasn't hidden prior to LCP.\n                if (renderTime < visibilityWatcher.firstHiddenTime) {\n                    metric.value = value;\n                    metric.entries = metricEntries;\n                    report();\n                }\n            }\n        };\n        const types = ['largest-contentful-paint'];\n        if (softNavsEnabled) {\n            types.push('interaction-contentful-paint', 'soft-navigation');\n        }\n        const po = observe(types, handleEntries);\n        if (po) {\n            report = bindReporter(onReport, metric, LCPThresholds, opts.reportAllChanges);\n            const finalizeEventTypes = ['keydown', 'click', 'visibilitychange'];\n            const finalizeLCP = (event) => {\n                if (event.isTrusted && !isFinalized) {\n                    // Wrap the listener in an idle callback so it's run in a separate\n                    // task to reduce potential INP impact.\n                    // https://github.com/GoogleChrome/web-vitals/issues/383\n                    const metricIdToFinalize = metric.id;\n                    whenIdleOrHidden(() => {\n                        if (!isFinalized) {\n                            if (!softNavsEnabled) {\n                                // Do some clean up since these won't be needed anymore.\n                                po.disconnect();\n                                for (const type of finalizeEventTypes) {\n                                    removeEventListener(type, finalizeLCP, { capture: true });\n                                }\n                            }\n                            // As this is in a whenIdleOrHidden check, whether we're still\n                            // on the metric you meant to finalize, and ignore if we've moved\n                            // on in the meantime.\n                            if (metricIdToFinalize === metric.id) {\n                                isFinalized = true;\n                                report(true);\n                            }\n                        }\n                    });\n                }\n            };\n            // Finalize the current LCP after input or visibilitychange.\n            // Although the browser will automatically stop emitting entries in these\n            // cases, we don't know it's finalized, so we track to allow early report.\n            // Note: while scrolling is an input that stops LCP observation, it's\n            // unreliable since it can be programmatically generated.\n            // See: https://github.com/GoogleChrome/web-vitals/issues/75\n            for (const type of finalizeEventTypes) {\n                addEventListener(type, finalizeLCP, {\n                    capture: true,\n                });\n            }\n            // Only report after a bfcache restore if the `PerformanceObserver`\n            // successfully registered.\n            onBFCacheRestore((event) => {\n                initNewLCPMetric('back-forward-cache', metric.navigationId, metric.navigationInteractionId, metric.navigationURL, getBFCacheRestoreTime());\n                report = bindReporter(onReport, metric, LCPThresholds, opts.reportAllChanges);\n                doubleRAF(() => {\n                    metric.value = performance.now() - event.timeStamp;\n                    isFinalized = true;\n                    report(true);\n                });\n            });\n        }\n    });\n};\n//# sourceMappingURL=onLCP.js.map","/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { bindReporter } from './lib/bindReporter.js';\nimport { checkSoftNavsEnabled } from './lib/softNavs.js';\nimport { getNavigationEntry } from './lib/getNavigationEntry.js';\nimport { getActivationStart } from './lib/getActivationStart.js';\nimport { initMetric } from './lib/initMetric.js';\nimport { observe } from './lib/observe.js';\nimport { getBFCacheRestoreTime, onBFCacheRestore } from './lib/bfcache.js';\nimport { whenActivated } from './lib/whenActivated.js';\n/** Thresholds for TTFB. See https://web.dev/articles/ttfb#what_is_a_good_ttfb_score */\nexport const TTFBThresholds = [800, 1800];\n/**\n * Runs in the next task after the page is done loading and/or prerendering.\n * @param callback\n */\nconst whenReady = (callback) => {\n    if (document.prerendering) {\n        whenActivated(() => whenReady(callback));\n    }\n    else if (document.readyState !== 'complete') {\n        addEventListener('load', () => whenReady(callback), true);\n    }\n    else {\n        // Queue a task so the callback runs after `loadEventEnd`.\n        setTimeout(callback);\n    }\n};\n/**\n * Calculates the [TTFB](https://web.dev/articles/ttfb) value for the\n * current page and calls the `callback` function once the page has loaded,\n * along with the relevant `navigation` performance entry used to determine the\n * value. The reported value is a `DOMHighResTimeStamp`.\n *\n * Note, this function waits until after the page is loaded to call `callback`\n * in order to ensure all properties of the `navigation` entry are populated.\n * This is useful if you want to report on other metrics exposed by the\n * [Navigation Timing API](https://w3c.github.io/navigation-timing/). For\n * example, the TTFB metric starts from the page's [time\n * origin](https://www.w3.org/TR/hr-time-2/#sec-time-origin), which means it\n * includes time spent on DNS lookup, connection negotiation, network latency,\n * and server processing time.\n */\nexport const onTTFB = (onReport, opts = {}) => {\n    const softNavsEnabled = checkSoftNavsEnabled(opts);\n    let metric = initMetric('TTFB');\n    let report = bindReporter(onReport, metric, TTFBThresholds, opts.reportAllChanges);\n    whenReady(() => {\n        const hardNavEntry = getNavigationEntry();\n        if (hardNavEntry) {\n            const responseStart = hardNavEntry.responseStart;\n            // The activationStart reference is used because TTFB should be\n            // relative to page activation rather than navigation start if the\n            // page was prerendered. But in cases where `activationStart` occurs\n            // after the first byte is received, this time should be clamped at 0.\n            metric.value = Math.max(responseStart - getActivationStart(), 0);\n            metric.entries = [hardNavEntry];\n            report(true);\n            // Only report TTFB after bfcache restores if a `navigation` entry\n            // was reported for the initial load.\n            onBFCacheRestore(() => {\n                metric = initMetric('TTFB', 0, 'back-forward-cache', metric.navigationId, metric.navigationInteractionId, metric.navigationURL, getBFCacheRestoreTime());\n                report = bindReporter(onReport, metric, TTFBThresholds, opts.reportAllChanges);\n                report(true);\n            });\n            // Listen for soft-navigation entries and emit a dummy 0 TTFB entry\n            if (softNavsEnabled) {\n                const reportSoftNavTTFBs = (entries) => {\n                    entries.forEach((entry) => {\n                        if (entry.navigationId) {\n                            metric = initMetric('TTFB', 0, 'soft-navigation', entry.navigationId, entry.interactionId, entry.name, entry.startTime);\n                            metric.entries = [entry];\n                            report = bindReporter(onReport, metric, TTFBThresholds, opts.reportAllChanges);\n                            report(true);\n                        }\n                    });\n                };\n                observe(['soft-navigation'], reportSoftNavTTFBs, opts);\n            }\n        }\n    });\n};\n//# sourceMappingURL=onTTFB.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { getBFCacheRestoreTime } from '../lib/bfcache.js';\nimport { getLoadState } from '../lib/getLoadState.js';\nimport { getNavigationEntry } from '../lib/getNavigationEntry.js';\nimport { initUnique } from '../lib/initUnique.js';\nimport { FCPEntryManager } from '../lib/FCPEntryManager.js';\nimport { checkSoftNavsEnabled } from '../lib/softNavs.js';\nimport { onFCP as unattributedOnFCP } from '../onFCP.js';\nexport const onFCP = (onReport, opts = {}) => {\n    opts = Object.assign({}, opts);\n    // Init the fcpEntryManager (which will already be initialised in the\n    // unattributed onFCP method if soft navigation reporting is enabled\n    // and so will return that fcpEntryManager, rather than a new one)\n    const fcpEntryManager = initUnique(opts, FCPEntryManager);\n    if (checkSoftNavsEnabled(opts)) {\n        fcpEntryManager._softNavigationEntryMap = new Map();\n    }\n    const attributeFCP = (metric) => {\n        // Use a default object if no other attribution has been set.\n        let attribution = {\n            timeToFirstByte: 0,\n            firstByteToFCP: metric.value,\n            loadState: getLoadState(getBFCacheRestoreTime()),\n        };\n        if (metric.navigationType !== 'soft-navigation') {\n            if (metric.entries.length) {\n                const navigationEntry = getNavigationEntry();\n                const fcpEntry = metric.entries.at(-1);\n                if (navigationEntry) {\n                    const responseStart = navigationEntry.responseStart;\n                    const activationStart = navigationEntry.activationStart || 0;\n                    const ttfb = Math.max(0, responseStart - activationStart);\n                    attribution = {\n                        timeToFirstByte: ttfb,\n                        firstByteToFCP: metric.value - ttfb,\n                        loadState: getLoadState(metric.entries[0].startTime),\n                        navigationEntry,\n                        fcpEntry,\n                    };\n                }\n            }\n        }\n        else {\n            // Lookup the soft navigation entry. Do not use getEntriesByType since\n            // that is limited to the first 50 navigation entries due to buffer size.\n            const navigationEntry = fcpEntryManager._softNavigationEntryMap?.get(metric.navigationId);\n            if (navigationEntry) {\n                attribution = {\n                    timeToFirstByte: 0,\n                    firstByteToFCP: metric.value,\n                    loadState: 'complete',\n                    navigationEntry,\n                };\n            }\n        }\n        // Use `Object.assign()` to ensure the original metric object is returned.\n        const metricWithAttribution = Object.assign(metric, { attribution });\n        return metricWithAttribution;\n    };\n    unattributedOnFCP((metric) => {\n        onReport(attributeFCP(metric));\n    }, opts);\n};\n//# sourceMappingURL=onFCP.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { getLoadState } from '../lib/getLoadState.js';\nimport { getSelector } from '../lib/getSelector.js';\nimport { initUnique } from '../lib/initUnique.js';\nimport { InteractionManager, } from '../lib/InteractionManager.js';\nimport { observe } from '../lib/observe.js';\nimport { whenIdleOrHidden } from '../lib/whenIdleOrHidden.js';\nimport { onINP as unattributedOnINP } from '../onINP.js';\n// The maximum number of previous frames for which data is kept.\n// Storing data about previous frames is necessary to handle cases where event\n// and LoAF entries are dispatched out of order, and so a buffer of previous\n// frame data is needed to determine various bits of INP attribution once all\n// the frame-related data has come in.\n// In most cases this out-of-order data is only off by a frame or two, so\n// keeping the most recent 10 should be more than sufficient.\nconst MAX_PENDING_FRAMES = 10;\n/**\n * Calculates the [INP](https://web.dev/articles/inp) value for the current\n * page and calls the `callback` function once the value is ready, along with\n * the `event` performance entries reported for that interaction. The reported\n * value is a `DOMHighResTimeStamp`.\n *\n * A custom `durationThreshold` configuration option can optionally be passed\n * to control what `event-timing` entries are considered for INP reporting. The\n * default threshold is `40`, which means INP scores of less than 40 will not\n * be reported. To avoid reporting no interactions in these cases, the library\n * will fall back to the input delay of the first interaction. Note that this\n * will not affect your 75th percentile INP value unless that value is also\n * less than 40 (well below the recommended\n * [good](https://web.dev/articles/inp#what_is_a_good_inp_score) threshold).\n *\n * A custom `includeProcessedEventEntries` configuration option can optionally\n * be passed to control whether the `processedEventEntries` array in the\n * attribution object is populated. The default value is `false`.\n *\n * If the `reportAllChanges` configuration option is set to `true`, the\n * `callback` function will be called as soon as the value is initially\n * determined as well as any time the value changes throughout the page\n * lifespan.\n *\n * _**Important:** INP should be continually monitored for changes throughout\n * the entire lifespan of a page—including if the user returns to the page after\n * it has been hidden/backgrounded. However, since browsers often [will not fire\n * additional callbacks once the user has backgrounded a\n * page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden),\n * `callback` is always called when the page's visibility state changes to\n * hidden. As a result, the `callback` function might be called multiple times\n * during the same page load._\n */\nexport const onINP = (onReport, opts = {}) => {\n    // Clone the opts object to ensure it's unique, so we can initialize a\n    // single instance of the `InteractionManager` class that's shared only with\n    // this function invocation and the `unattributedOnINP()` invocation below\n    // (which is passed the same `opts` object).\n    opts = Object.assign({}, opts);\n    const interactionManager = initUnique(opts, InteractionManager);\n    // A list of LoAF entries that have been dispatched and could potentially\n    // intersect with the INP candidate interaction. Note that periodically this\n    // list is cleaned up and entries that are known to not match INP are removed.\n    let pendingLoAFs = [];\n    // An array of groups of all the event timing entries that occurred within a\n    // particular frame. Note that periodically this array is cleaned up and entries\n    // that are known to not match INP are removed.\n    let pendingEntriesGroups = [];\n    // The `processingEnd` time of most recently-processed event, chronologically.\n    let latestProcessingEnd = 0;\n    // A WeakMap to look up the event-timing-entries group of a given entry.\n    // Note that this only maps from \"important\" entries: either the first input or\n    // those with an `interactionId`.\n    const entryToEntriesGroupMap = new WeakMap();\n    // A mapping of interactionIds to the target Node.\n    const interactionTargetMap = new WeakMap();\n    // A boolean flag indicating whether or not a cleanup task has been queued.\n    let cleanupPending = false;\n    /**\n     * Adds new LoAF entries to the `pendingLoAFs` list.\n     */\n    const handleLoAFEntries = (entries) => {\n        pendingLoAFs = pendingLoAFs.concat(entries);\n        queueCleanup();\n    };\n    const saveInteractionTarget = (interaction) => {\n        if (!interactionTargetMap.get(interaction)) {\n            // Use find to get first selector\n            const node = interaction.entries.find((e) => e.target)?.target;\n            if (node) {\n                const customTarget = opts.generateTarget?.(node) ?? getSelector(node);\n                interactionTargetMap.set(interaction, customTarget);\n            }\n            else {\n                // Fall back to targetSelector\n                const selector = interaction.entries.find((e) => e.targetSelector)?.targetSelector;\n                if (selector) {\n                    interactionTargetMap.set(interaction, selector);\n                }\n            }\n        }\n    };\n    /**\n     * Groups entries that were presented within the same animation frame by\n     * a common `renderTime`. This function works by referencing\n     * `pendingEntriesGroups` and using an existing render time if one is found\n     * (otherwise creating a new one). This function also adds all interaction\n     * entries to an `entryToRenderTimeMap` WeakMap so that the \"grouped\" entries\n     * can be looked up later.\n     */\n    const groupEntriesByRenderTime = (entry) => {\n        const renderTime = entry.startTime + entry.duration;\n        let group;\n        // Update `latestProcessingEnd` to correspond to the `processingEnd`\n        // value of the most recently dispatched `event` entry.\n        latestProcessingEnd = Math.max(latestProcessingEnd, entry.processingEnd);\n        // Iterate over all previous render times in reverse order to find a match.\n        // Go in reverse since the most likely match will be at the end.\n        for (let i = pendingEntriesGroups.length - 1; i >= 0; i--) {\n            const potentialGroup = pendingEntriesGroups[i];\n            // If a group's render time is within 8ms of the entry's render time,\n            // assume they were part of the same frame and add it to the group.\n            if (Math.abs(renderTime - potentialGroup.renderTime) <= 8) {\n                group = potentialGroup;\n                group.startTime = Math.min(entry.startTime, group.startTime);\n                group.processingStart = Math.min(entry.processingStart, group.processingStart);\n                group.processingEnd = Math.max(entry.processingEnd, group.processingEnd);\n                // processedEventEntries can be quite large, so only include them if\n                // the user explicitly requests them (default is to include).\n                if (opts.includeProcessedEventEntries) {\n                    group.entries.push(entry);\n                }\n                break;\n            }\n        }\n        // If there was no matching group, assume this is a new frame.\n        if (!group) {\n            group = {\n                startTime: entry.startTime,\n                processingStart: entry.processingStart,\n                processingEnd: entry.processingEnd,\n                renderTime,\n                // processedEventEntries can be quite large, so only include them if\n                // the user explicitly requests them (default is to include).\n                entries: opts.includeProcessedEventEntries ? [entry] : [],\n            };\n            pendingEntriesGroups.push(group);\n        }\n        // Store the grouped render time for this entry for reference later.\n        if (entry.interactionId || entry.entryType === 'first-input') {\n            entryToEntriesGroupMap.set(entry, group);\n        }\n        queueCleanup();\n    };\n    const queueCleanup = () => {\n        // Queue cleanup of entries that are not part of any INP candidates.\n        if (!cleanupPending) {\n            whenIdleOrHidden(cleanupEntries);\n            cleanupPending = true;\n        }\n    };\n    const cleanupEntries = () => {\n        // Create a set of entries groups that are part of the longest\n        // interactions (for faster lookup below).\n        const longestInteractionGroups = new Set(interactionManager._longestInteractionList.map((i) => {\n            return entryToEntriesGroupMap.get(i.entries[0]);\n        }));\n        // Clean up the `pendingEntriesGroups` list so it doesn't grow endlessly.\n        // Keep any groups that:\n        // 1) Correspond to one of the current longest interactions, OR\n        // 2) Are part of one of the most recent set of frames (which is\n        //    determined by checking if the index in the group is within\n        //    `MAX_PENDING_FRAMES` of the group's length).\n        const minIndexToKeep = pendingEntriesGroups.length - MAX_PENDING_FRAMES;\n        pendingEntriesGroups = pendingEntriesGroups.filter((group, i) => {\n            // Check index first because it's faster.\n            return i >= minIndexToKeep || longestInteractionGroups.has(group);\n        });\n        // Create a set of LoAF entries that intersect with entries in the newly\n        // cleaned up `pendingEntriesGroups` (for faster lookup below).\n        const intersectingLoAFs = new Set();\n        for (const group of pendingEntriesGroups) {\n            const loafs = getIntersectingLoAFs(group.startTime, group.processingEnd);\n            for (const loaf of loafs) {\n                intersectingLoAFs.add(loaf);\n            }\n        }\n        // Clean up the `pendingLoAFs` list so it doesn't grow endlessly.\n        // Keep all LoAFs that either:\n        // 1) Intersect with one of the above pending entries groups, OR\n        // 2) Occurred more recently than the most recently process event entry.\n        pendingLoAFs = pendingLoAFs.filter((loaf) => {\n            return (\n            // Compare times first because it's faster.\n            loaf.startTime > latestProcessingEnd || intersectingLoAFs.has(loaf));\n        });\n        cleanupPending = false;\n    };\n    interactionManager._onBeforeProcessingEntry = groupEntriesByRenderTime;\n    interactionManager._onAfterProcessingINPCandidate = saveInteractionTarget;\n    const getIntersectingLoAFs = (start, end) => {\n        const intersectingLoAFs = [];\n        for (const loaf of pendingLoAFs) {\n            // If the LoAF ends before the given start time, ignore it.\n            if (loaf.startTime + loaf.duration < start)\n                continue;\n            // If the LoAF starts after the given end time, ignore it and all\n            // subsequent pending LoAFs (because they're in time order).\n            if (loaf.startTime > end)\n                break;\n            // Still here? If so this LoAF intersects with the interaction.\n            intersectingLoAFs.push(loaf);\n        }\n        return intersectingLoAFs;\n    };\n    const attributeLoAFDetails = (attribution) => {\n        const interactionTime = attribution.interactionTime;\n        const nextPaintTime = attribution.nextPaintTime;\n        // If there is no LoAF data, interactionTime or paintTime\n        // then nothing further to attribute here.\n        if (!attribution.longAnimationFrameEntries?.length ||\n            !interactionTime ||\n            !nextPaintTime) {\n            return;\n        }\n        const inputDelay = attribution.inputDelay;\n        const processingDuration = attribution.processingDuration;\n        // Stats across all LoAF entries and scripts.\n        let totalScriptDuration = 0;\n        let totalStyleAndLayoutDuration = 0;\n        let totalPaintDuration = 0;\n        let longestScriptDuration = 0;\n        let longestScriptEntry;\n        let longestScriptSubpart;\n        for (const loafEntry of attribution.longAnimationFrameEntries) {\n            totalStyleAndLayoutDuration =\n                totalStyleAndLayoutDuration +\n                    loafEntry.startTime +\n                    loafEntry.duration -\n                    loafEntry.styleAndLayoutStart;\n            for (const script of loafEntry.scripts) {\n                const scriptEndTime = script.startTime + script.duration;\n                if (scriptEndTime < interactionTime) {\n                    continue;\n                }\n                const intersectingScriptDuration = scriptEndTime - Math.max(interactionTime, script.startTime);\n                // Since forcedStyleAndLayoutDuration doesn't provide timestamps, we\n                // apportion the total based on the intersectingScriptDuration. Not\n                // correct depending on when it occurred, but the best we can do.\n                const intersectingForceStyleAndLayoutDuration = script.duration\n                    ? (intersectingScriptDuration / script.duration) *\n                        script.forcedStyleAndLayoutDuration\n                    : 0;\n                // For scripts we exclude forcedStyleAndLayout (same as DevTools does\n                // in its summary totals) and instead include that in\n                // totalStyleAndLayoutDuration\n                totalScriptDuration +=\n                    intersectingScriptDuration - intersectingForceStyleAndLayoutDuration;\n                totalStyleAndLayoutDuration += intersectingForceStyleAndLayoutDuration;\n                if (intersectingScriptDuration > longestScriptDuration) {\n                    // Set the subpart this occurred in.\n                    longestScriptSubpart =\n                        script.startTime < interactionTime + inputDelay\n                            ? 'input-delay'\n                            : script.startTime >=\n                                interactionTime + inputDelay + processingDuration\n                                ? 'presentation-delay'\n                                : 'processing-duration';\n                    longestScriptEntry = script;\n                    longestScriptDuration = intersectingScriptDuration;\n                }\n            }\n        }\n        // Calculate the totalPaintDuration from the last LoAF after\n        // presentationDelay starts (where available)\n        const lastLoAF = attribution.longAnimationFrameEntries.at(-1);\n        const lastLoAFEndTime = lastLoAF\n            ? lastLoAF.startTime + lastLoAF.duration\n            : 0;\n        if (lastLoAFEndTime >= interactionTime + inputDelay + processingDuration) {\n            totalPaintDuration = nextPaintTime - lastLoAFEndTime;\n        }\n        if (longestScriptEntry && longestScriptSubpart) {\n            attribution.longestScript = {\n                entry: longestScriptEntry,\n                subpart: longestScriptSubpart,\n                intersectingDuration: longestScriptDuration,\n            };\n        }\n        attribution.totalScriptDuration = totalScriptDuration;\n        attribution.totalStyleAndLayoutDuration = totalStyleAndLayoutDuration;\n        attribution.totalPaintDuration = totalPaintDuration;\n        attribution.totalUnattributedDuration =\n            nextPaintTime -\n                interactionTime -\n                totalScriptDuration -\n                totalStyleAndLayoutDuration -\n                totalPaintDuration;\n    };\n    const attributeINP = (metric) => {\n        // Soft navs and bfcache can have a dummy INP as no first-input entry to\n        // fall back on so we report dummy values when the interactionCount has\n        // gone up, even if no entry was emitted.\n        // See https://github.com/GoogleChrome/web-vitals/issues/724\n        // All other INPs should have at least one entry, but we'll do same dummy\n        // processing if they don't for some reason.\n        if (metric.entries.length === 0) {\n            const navStartTime = metric.navigationStartTime || 0;\n            const attribution = {\n                processedEventEntries: [],\n                longAnimationFrameEntries: [],\n                inputDelay: 0,\n                processingDuration: 0,\n                presentationDelay: metric.value,\n                loadState: getLoadState(navStartTime),\n            };\n            return Object.assign(metric, { attribution });\n        }\n        const firstEntry = metric.entries[0];\n        const group = entryToEntriesGroupMap.get(firstEntry);\n        const processingStart = group.processingStart;\n        // Due to the fact that durations can be rounded down to the nearest 8ms,\n        // we have to clamp `nextPaintTime` so it doesn't appear to occur before\n        // processing starts. Note: we can't use `processingEnd` since processing\n        // can extend beyond the event duration in some cases (see next comment).\n        const nextPaintTime = Math.max(firstEntry.startTime + firstEntry.duration, processingStart);\n        // For the purposes of attribution, clamp `processingEnd` to `nextPaintTime`,\n        // so processing is never reported as taking longer than INP (which can\n        // happen via the web APIs in the case of sync modals, e.g. `alert()`).\n        // See: https://github.com/GoogleChrome/web-vitals/issues/492\n        const processingEnd = Math.min(group.processingEnd, nextPaintTime);\n        // Sort the entries in processing time order.\n        const processedEventEntries = group.entries.sort((a, b) => {\n            return a.processingStart - b.processingStart;\n        });\n        const longAnimationFrameEntries = getIntersectingLoAFs(firstEntry.startTime, processingEnd);\n        const interaction = interactionManager._longestInteractionMap.get(firstEntry.interactionId);\n        const attribution = {\n            // TS flags the next line because `interactionTargetMap.get()` might\n            // return `undefined`, but we ignore this assuming the user knows what\n            // they are doing.\n            interactionTarget: interactionTargetMap.get(interaction),\n            interactionType: firstEntry.name.startsWith('key')\n                ? 'keyboard'\n                : 'pointer',\n            interactionTime: firstEntry.startTime,\n            nextPaintTime: nextPaintTime,\n            processedEventEntries: processedEventEntries,\n            longAnimationFrameEntries: longAnimationFrameEntries,\n            inputDelay: processingStart - firstEntry.startTime,\n            processingDuration: processingEnd - processingStart,\n            presentationDelay: nextPaintTime - processingEnd,\n            loadState: getLoadState(firstEntry.startTime),\n            longestScript: undefined,\n            totalScriptDuration: undefined,\n            totalStyleAndLayoutDuration: undefined,\n            totalPaintDuration: undefined,\n            totalUnattributedDuration: undefined,\n        };\n        attributeLoAFDetails(attribution);\n        // Use `Object.assign()` to ensure the original metric object is returned.\n        return Object.assign(metric, { attribution });\n    };\n    // Start observing LoAF entries for attribution.\n    observe(['long-animation-frame'], handleLoAFEntries, opts);\n    unattributedOnINP((metric) => {\n        onReport(attributeINP(metric));\n    }, opts);\n};\n//# sourceMappingURL=onINP.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { getNavigationEntry } from '../lib/getNavigationEntry.js';\nimport { getSelector } from '../lib/getSelector.js';\nimport { initUnique } from '../lib/initUnique.js';\nimport { LCPEntryManager } from '../lib/LCPEntryManager.js';\nimport { checkSoftNavsEnabled } from '../lib/softNavs.js';\nimport { onLCP as unattributedOnLCP } from '../onLCP.js';\n/**\n * Calculates the [LCP](https://web.dev/articles/lcp) value for the current page and\n * calls the `callback` function once the value is ready (along with the\n * relevant `largest-contentful-paint` performance entry used to determine the\n * value). The reported value is a `DOMHighResTimeStamp`.\n *\n * If the `reportAllChanges` configuration option is set to `true`, the\n * `callback` function will be called any time a new `largest-contentful-paint`\n * performance entry is dispatched, or once the final value of the metric has\n * been determined.\n */\nexport const onLCP = (onReport, opts = {}) => {\n    // Clone the opts object to ensure it's unique, so we can initialize a\n    // single instance of the `LCPEntryManager` class that's shared only with\n    // this function invocation and the `unattributedOnLCP()` invocation below\n    // (which is passed the same `opts` object).\n    opts = Object.assign({}, opts);\n    const lcpEntryManager = initUnique(opts, LCPEntryManager);\n    const lcpTargetMap = new WeakMap();\n    if (checkSoftNavsEnabled(opts)) {\n        lcpEntryManager._softNavigationEntryMap = new Map();\n    }\n    lcpEntryManager._onBeforeProcessingEntry = (entry) => {\n        const node = entry.element;\n        if (node) {\n            const customTarget = opts.generateTarget?.(node) ?? getSelector(node);\n            lcpTargetMap.set(entry, customTarget);\n        }\n        else if (entry.id) {\n            // Use the LargestContentfulPaint.id property when the element has been\n            // removed from the DOM (and so node is null), but still has an ID.\n            lcpTargetMap.set(entry, `#${entry.id}`);\n        }\n    };\n    const attributeLCP = (metric) => {\n        // Use a default object if no other attribution has been set.\n        let attribution = {\n            timeToFirstByte: 0,\n            resourceLoadDelay: 0,\n            resourceLoadDuration: 0,\n            elementRenderDelay: metric.value,\n        };\n        if (metric.entries.length) {\n            // The `metric.entries.length` check ensures there will be an entry.\n            const lcpEntry = metric.entries.at(-1);\n            const lcpResourceEntry = lcpEntry.url &&\n                performance\n                    .getEntriesByType('resource')\n                    .find((e) => e.name === lcpEntry.url);\n            attribution.target = lcpTargetMap.get(lcpEntry);\n            attribution.lcpEntry = lcpEntry;\n            // Only attribute the URL and resource entry if they exist.\n            if (lcpEntry.url) {\n                attribution.url = lcpEntry.url;\n            }\n            if (lcpResourceEntry) {\n                attribution.lcpResourceEntry = lcpResourceEntry;\n            }\n            // Get subparts from navigation entry. Do this last as occasionally\n            // Safari seems to fail to find a navigation entry.\n            let navigationEntry;\n            let activationStart = 0;\n            let responseStart = 0;\n            if (metric.navigationType !== 'soft-navigation') {\n                navigationEntry = getNavigationEntry();\n                activationStart = navigationEntry?.activationStart ?? 0;\n                responseStart = navigationEntry?.responseStart ?? 0;\n            }\n            else {\n                // Set activationStart to the navigation start time\n                activationStart = metric.navigationStartTime || 0;\n                // Lookup the soft navigation entry. Do not use getEntriesByType since\n                // that is limited to the first 50 navigation entries due to buffer\n                // size.\n                navigationEntry = lcpEntryManager._softNavigationEntryMap?.get(metric.navigationId);\n            }\n            if (navigationEntry) {\n                const ttfb = Math.max(0, responseStart - activationStart);\n                const lcpRequestStart = Math.max(ttfb, \n                // Prefer `requestStart` (if TOA is set), otherwise use `startTime`.\n                lcpResourceEntry\n                    ? (lcpResourceEntry.requestStart || lcpResourceEntry.startTime) -\n                        activationStart\n                    : 0);\n                const lcpResponseEnd = Math.min(\n                // Cap at LCP time (videos continue downloading after LCP for example)\n                metric.value, Math.max(lcpRequestStart, lcpResourceEntry\n                    ? lcpResourceEntry.responseEnd - activationStart\n                    : 0));\n                attribution = {\n                    ...attribution,\n                    timeToFirstByte: ttfb,\n                    resourceLoadDelay: lcpRequestStart - ttfb,\n                    resourceLoadDuration: lcpResponseEnd - lcpRequestStart,\n                    elementRenderDelay: metric.value - lcpResponseEnd,\n                    navigationEntry,\n                };\n            }\n        }\n        // Use `Object.assign()` to ensure the original metric object is returned.\n        return Object.assign(metric, { attribution });\n    };\n    unattributedOnLCP((metric) => {\n        onReport(attributeLCP(metric));\n    }, opts);\n};\n//# sourceMappingURL=onLCP.js.map","/*\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { onTTFB as unattributedOnTTFB } from '../onTTFB.js';\nconst attributeTTFB = (metric) => {\n    const navigationEntry = metric.entries[0];\n    // Use a default object if no other attribution has been set.\n    let attribution = {\n        waitingDuration: 0,\n        cacheDuration: 0,\n        dnsDuration: 0,\n        connectionDuration: 0,\n        requestDuration: 0,\n        // There should only be one instance per TTFB metric\n        navigationEntry: navigationEntry,\n    };\n    if (metric.entries.length) {\n        // If it's the hard nav, then can give attribution.\n        // Otherwise it's 0 so the defaults are fine.\n        if (navigationEntry instanceof PerformanceNavigationTiming) {\n            const activationStart = navigationEntry.activationStart || 0;\n            // Measure from workerStart or fetchStart so any service worker startup\n            // time is included in cacheDuration (which also includes other sw time\n            // anyway, that cannot be accurately split out cross-browser).\n            const waitEnd = Math.max((navigationEntry.workerStart || navigationEntry.fetchStart || 0) -\n                activationStart, 0);\n            const dnsStart = Math.max(navigationEntry.domainLookupStart - activationStart, 0);\n            const connectStart = Math.max(navigationEntry.connectStart - activationStart, 0);\n            const connectEnd = Math.max(navigationEntry.connectEnd - activationStart, 0);\n            attribution = {\n                waitingDuration: waitEnd,\n                cacheDuration: dnsStart - waitEnd,\n                // dnsEnd usually equals connectStart but use connectStart over dnsEnd\n                // for dnsDuration in case there ever is a gap.\n                dnsDuration: connectStart - dnsStart,\n                connectionDuration: connectEnd - connectStart,\n                // There is often a gap between connectEnd and requestStart. Attribute\n                // that to requestDuration so connectionDuration remains 0 for\n                // service worker controlled requests were connectStart and connectEnd\n                // are the same.\n                requestDuration: metric.value - connectEnd,\n                navigationEntry: navigationEntry,\n            };\n        }\n    }\n    // Use `Object.assign()` to ensure the original metric object is returned.\n    const metricWithAttribution = Object.assign(metric, { attribution });\n    return metricWithAttribution;\n};\n/**\n * Calculates the [TTFB](https://web.dev/articles/ttfb) value for the\n * current page and calls the `callback` function once the page has loaded,\n * along with the relevant `navigation` performance entry used to determine the\n * value. The reported value is a `DOMHighResTimeStamp`.\n *\n * Note, this function waits until after the page is loaded to call `callback`\n * in order to ensure all properties of the `navigation` entry are populated.\n * This is useful if you want to report on other metrics exposed by the\n * [Navigation Timing API](https://w3c.github.io/navigation-timing/). For\n * example, the TTFB metric starts from the page's [time\n * origin](https://www.w3.org/TR/hr-time-2/#sec-time-origin), which means it\n * includes time spent on DNS lookup, connection negotiation, network latency,\n * and server processing time.\n */\nexport const onTTFB = (onReport, opts = {}) => {\n    unattributedOnTTFB((metric) => {\n        onReport(attributeTTFB(metric));\n    }, opts);\n};\n//# sourceMappingURL=onTTFB.js.map"],"names":["LayoutShiftManager","_onAfterProcessingUnexpectedShift","_sessionValue","_sessionEntries","_processEntry","entry","hadRecentInput","firstSessionEntry","this","lastSessionEntry","at","startTime","value","push","getNavigationEntry","navigationEntry","performance","getEntriesByType","responseStart","now","getLoadState","timestamp","document","readyState","hardNavEntry","domInteractive","domContentLoadedEventStart","domComplete","getName","node","name","nodeName","nodeType","toLowerCase","toUpperCase","replace","getSelector","sel","el","part","id","Array","from","classList","sort","join","length","MAX_LEN","parentNode","instanceMap","WeakMap","initUnique","identityObj","ClassObj","classInstances","get","set","bfcacheRestoreTime","getBFCacheRestoreTime","onBFCacheRestore","cb","addEventListener","event","persisted","timeStamp","bindReporter","callback","metric","thresholds","reportAllChanges","prevValue","delta","forceReport","undefined","rating","getRating","doubleRAF","requestAnimationFrame","getActivationStart","activationStart","firstHiddenTime","onHiddenFunctions","Set","initHiddenTime","visibilityState","prerendering","Infinity","onVisibilityUpdate","type","onHiddenFunction","isFinite","removeEventListener","getVisibilityWatcher","reset","firstVisibilityStateHiddenTime","globalThis","find","e","setTimeout","onHidden","add","initMetric","navigationType","navigationId","navigationInteractionId","navigationURL","navigationStartTime","hardNavId","_navigationType","wasDiscarded","entries","Date","Math","floor","random","observe","types","opts","supportedTypes","filter","t","PerformanceObserver","supportedEntryTypes","includes","po","list","queueMicrotask","getEntries","a","b","duration","buffered","checkSoftNavsEnabled","PerformanceSoftNavigation","prototype","getLargestInteractionContentfulPaint","reportSoftNavs","storeSoftNavEntry","map","size","firstKey","keys","next","delete","runOnce","called","FCPEntryManager","_softNavigationEntryMap","whenActivated","FCPThresholds","onFCP","onReport","softNavsEnabled","fcpEntryManager","visibilityWatcher","report","disconnect","max","forEach","FCPTime","presentationTime","paintTime","interactionId","CLSThresholds","getLargestLayoutShiftSource","sources","s","interactionCountEstimate","minKnownInteractionId","maxKnownInteractionId","updateEstimate","min","getInteractionCount","interactionCount","initInteractionCountPolyfill","durationThreshold","prevInteractionCount","InteractionManager","_longestInteractionList","_longestInteractionMap","Map","_onBeforeProcessingEntry","_onAfterProcessingINPCandidate","_resetInteractions","clear","_estimateP98LongestInteraction","interactionCountForNavigation","candidateInteractionIndex","_latency","entryType","minLongestInteraction","interaction","removedInteractions","splice","whenIdleOrHidden","timeout","rIC","requestIdleCallback","cIC","cancelIdleCallback","clearTimeout","wrappedCb","idleHandle","once","capture","INPThresholds","LCPEntryManager","LCPThresholds","TTFBThresholds","whenReady","onCLS","layoutShiftManager","Object","assign","layoutShiftTargetMap","largestSource","customTarget","generateTarget","initNewCLSMetric","updateAndReportMetric","handleSoftNavEntry","handleEntries","takeRecords","unattributedOnCLS","attribution","largestEntry","reduce","largestShiftTarget","largestShiftTime","largestShiftValue","largestShiftSource","largestShiftEntry","loadState","attributeCLS","unattributedOnFCP","timeToFirstByte","firstByteToFCP","fcpEntry","ttfb","attributeFCP","onINP","interactionManager","pendingLoAFs","pendingEntriesGroups","latestProcessingEnd","entryToEntriesGroupMap","interactionTargetMap","cleanupPending","queueCleanup","cleanupEntries","longestInteractionGroups","i","minIndexToKeep","group","has","intersectingLoAFs","loafs","getIntersectingLoAFs","processingEnd","loaf","renderTime","potentialGroup","abs","processingStart","includeProcessedEventEntries","target","selector","targetSelector","start","end","attributeINP","navStartTime","processedEventEntries","longAnimationFrameEntries","inputDelay","processingDuration","presentationDelay","firstEntry","nextPaintTime","interactionTarget","interactionType","startsWith","interactionTime","longestScript","totalScriptDuration","totalStyleAndLayoutDuration","totalPaintDuration","totalUnattributedDuration","longestScriptEntry","longestScriptSubpart","longestScriptDuration","loafEntry","styleAndLayoutStart","script","scripts","scriptEndTime","intersectingScriptDuration","intersectingForceStyleAndLayoutDuration","forcedStyleAndLayoutDuration","lastLoAF","lastLoAFEndTime","subpart","intersectingDuration","attributeLoAFDetails","concat","PerformanceEventTiming","initNewINPMetric","updateINPMetric","inp","unattributedOnINP","onLCP","lcpEntryManager","lcpTargetMap","element","isFinalized","initNewLCPMetric","navigation","largestInteractionContentfulPaint","slice","metricEntries","ICPEntry","largestContentfulPaint","finalizeEventTypes","finalizeLCP","isTrusted","metricIdToFinalize","unattributedOnLCP","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","lcpEntry","lcpResourceEntry","url","lcpRequestStart","requestStart","lcpResponseEnd","responseEnd","attributeLCP","onTTFB","unattributedOnTTFB","waitingDuration","cacheDuration","dnsDuration","connectionDuration","requestDuration","PerformanceNavigationTiming","waitEnd","workerStart","fetchStart","dnsStart","domainLookupStart","connectStart","connectEnd","attributeTTFB"],"mappings":"gPAgBM,MAAOA,EACXC,EAEAC,EAAgB,EAChBC,EAAiC,GAEjCC,CAAAA,CAAcC,GAEZ,GAAIA,EAAMC,eAAgB,OAE1B,MAAMC,EAAoBC,KAAKL,EAAgB,GACzCM,EAAmBD,KAAKL,EAAgBO,IAAG,GAO/CF,KAAKN,GACLK,GACAE,GACAJ,EAAMM,UAAYF,EAAiBE,UAAY,KAC/CN,EAAMM,UAAYJ,EAAkBI,UAAY,KAEhDH,KAAKN,GAAiBG,EAAMO,MAC5BJ,KAAKL,EAAgBU,KAAKR,KAE1BG,KAAKN,EAAgBG,EAAMO,MAC3BJ,KAAKL,EAAkB,CAACE,IAG1BG,KAAKP,IAAoCI,EAC3C,EChCK,MAAMS,EAAqBA,KAChC,MAAMC,EAAkBC,YAAYC,iBAAiB,cAAc,GASnE,GACEF,GACAA,EAAgBG,cAAgB,GAChCH,EAAgBG,cAAgBF,YAAYG,MAE5C,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