{"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/attribution/onLCP.js","modules/onTTFB.js","modules/attribution/onFCP.js","modules/attribution/onINP.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 (\n    // Firefox has a preference to disable this, which some people use so add a guard\n    globalThis.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;\nexport class InteractionManager {\n    /**\n     * The interaction count at the start of the current navigation, so p98\n     * interaction latencies only consider interactions since then.\n     *\n     * This is per-instance rather than module state: `initUnique()` gives every\n     * `onINP()` call its own manager, and a shared counter would let whichever\n     * instance resets first hide the interactions from all the others.\n     */\n    _prevInteractionCount = 0;\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    /**\n     * Returns the interaction count since the start of the current navigation\n     * (or the full page lifecycle if there were no soft navs / bfcache restores).\n     */\n    _getInteractionCountForNavigation() {\n        return getInteractionCount() - this._prevInteractionCount;\n    }\n    _resetInteractions() {\n        this._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 = this._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 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 { observe } from '../lib/observe.js';\nimport { onLCP as unattributedOnLCP } from '../onLCP.js';\n/**\n * Default resource buffer size to 50 to help attribute media LCPs to a URL and\n * for subpart attribution. This can be increased for pages that request a\n * large number of resources between the LCP resource and LCP candidates being\n * processed, particularly for soft navigations where the browser default first\n * 250 entries may not contain the LCP resource.\n */\nconst DEFAULT_RESOURCE_BUFFER_SIZE = 50;\nlet resourceBufferSizeLimit = DEFAULT_RESOURCE_BUFFER_SIZE;\nconst resourceBuffer = [];\nobserve(['resource'], (entries) => {\n    for (const entry of entries) {\n        resourceBuffer.push(entry);\n        // Keep only the last resourceBufferSizeLimit entries.\n        if (resourceBuffer.length > resourceBufferSizeLimit) {\n            resourceBuffer.shift();\n        }\n    }\n});\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    if (opts.resourceBufferSize != undefined) {\n        resourceBufferSizeLimit = opts.resourceBufferSize;\n    }\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            // Get the Resource Timing entry checking the local buffer first\n            // Use findLast to get the latest entry in case a resource is requested\n            // multiple times (can particularly affect soft nav page views).\n            const lcpResourceEntry = lcpEntry.url &&\n                (resourceBuffer.findLast((e) => e.name === lcpEntry.url) ||\n                    performance\n                        .getEntriesByType('resource')\n                        .findLast((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 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 { 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","InteractionManager","_prevInteractionCount","_longestInteractionList","_longestInteractionMap","Map","_onBeforeProcessingEntry","_onAfterProcessingINPCandidate","_getInteractionCountForNavigation","_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","resourceBufferSizeLimit","resourceBuffer","shift","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","resourceBufferSize","lcpEntryManager","lcpTargetMap","element","isFinalized","initNewLCPMetric","navigation","largestInteractionContentfulPaint","slice","metricEntries","ICPEntry","largestContentfulPaint","finalizeEventTypes","finalizeLCP","isTrusted","metricIdToFinalize","unattributedOnLCP","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","lcpEntry","lcpResourceEntry","url","findLast","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,OAAOJ,GCZEK,EAAgBC,IAC3B,GAA4B,YAAxBC,SAASC,WAGX,MAAO,UAGT,MAAMC,EAAeV,IACrB,GAAIU,EAAc,CAChB,GAAIH,EAAYG,EAAaC,eAC3B,MAAO,UACF,GACuC,IAA5CD,EAAaE,4BACbL,EAAYG,EAAaE,2BAIzB,MAAO,kBACF,GACwB,IAA7BF,EAAaG,aACbN,EAAYG,EAAaG,YAIzB,MAAO,oBAEX,CAIA,MAAO,YCjCHC,EAAWC,IACf,MAAMC,EAAOD,EAAKE,SAClB,OAAyB,IAAlBF,EAAKG,SACRF,EAAKG,cACLH,EAAKI,cAAcC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