Skip to content
Snippets Groups Projects
index.js 8.31 MiB
Newer Older
  • Learn to ignore specific revisions
  •       // Delete mark.fid as we don't want it to be part of final payload
          delete _measurements['mark.fid'];
        }
    
        // If FCP is not recorded we should not record the cls value
        // according to the new definition of CLS.
        if (!('fcp' in _measurements)) {
          delete _measurements.cls;
        }
    
        Object.keys(_measurements).forEach(measurementName => {
          transaction.setMeasurement(
            measurementName,
            _measurements[measurementName].value,
            _measurements[measurementName].unit,
          );
        });
    
        _tagMetricInfo(transaction);
      }
    
      _lcpEntry = undefined;
      _clsEntry = undefined;
      _measurements = {};
    }
    
    /** Create measure related spans */
    function _addMeasureSpans(
      transaction,
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      entry,
      startTime,
      duration,
      timeOrigin,
    ) {
      const measureStartTimestamp = timeOrigin + startTime;
      const measureEndTimestamp = measureStartTimestamp + duration;
    
      (0,_utils_js__WEBPACK_IMPORTED_MODULE_9__._startChild)(transaction, {
        description: entry.name ,
        endTimestamp: measureEndTimestamp,
        op: entry.entryType ,
        startTimestamp: measureStartTimestamp,
      });
    
      return measureStartTimestamp;
    }
    
    /** Instrument navigation entries */
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    function _addNavigationSpans(transaction, entry, timeOrigin) {
      ['unloadEvent', 'redirect', 'domContentLoadedEvent', 'loadEvent', 'connect'].forEach(event => {
        _addPerformanceNavigationTiming(transaction, entry, event, timeOrigin);
      });
      _addPerformanceNavigationTiming(transaction, entry, 'secureConnection', timeOrigin, 'TLS/SSL', 'connectEnd');
      _addPerformanceNavigationTiming(transaction, entry, 'fetch', timeOrigin, 'cache', 'domainLookupStart');
      _addPerformanceNavigationTiming(transaction, entry, 'domainLookup', timeOrigin, 'DNS');
      _addRequest(transaction, entry, timeOrigin);
    }
    
    /** Create performance navigation related spans */
    function _addPerformanceNavigationTiming(
      transaction,
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      entry,
      event,
      timeOrigin,
      description,
      eventEnd,
    ) {
      const end = eventEnd ? (entry[eventEnd] ) : (entry[`${event}End`] );
      const start = entry[`${event}Start`] ;
      if (!start || !end) {
        return;
      }
      (0,_utils_js__WEBPACK_IMPORTED_MODULE_9__._startChild)(transaction, {
        op: 'browser',
        description: (0,_sentry_utils_esm_buildPolyfills__WEBPACK_IMPORTED_MODULE_10__._nullishCoalesce)(description, () => ( event)),
        startTimestamp: timeOrigin + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.msToSec)(start),
        endTimestamp: timeOrigin + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.msToSec)(end),
      });
    }
    
    /** Create request and response related spans */
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    function _addRequest(transaction, entry, timeOrigin) {
      (0,_utils_js__WEBPACK_IMPORTED_MODULE_9__._startChild)(transaction, {
        op: 'browser',
        description: 'request',
        startTimestamp: timeOrigin + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.msToSec)(entry.requestStart ),
        endTimestamp: timeOrigin + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.msToSec)(entry.responseEnd ),
      });
    
      (0,_utils_js__WEBPACK_IMPORTED_MODULE_9__._startChild)(transaction, {
        op: 'browser',
        description: 'response',
        startTimestamp: timeOrigin + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.msToSec)(entry.responseStart ),
        endTimestamp: timeOrigin + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.msToSec)(entry.responseEnd ),
      });
    }
    
    /** Create resource-related spans */
    function _addResourceSpans(
      transaction,
      entry,
      resourceName,
      startTime,
      duration,
      timeOrigin,
    ) {
      // we already instrument based on fetch and xhr, so we don't need to
      // duplicate spans here.
      if (entry.initiatorType === 'xmlhttprequest' || entry.initiatorType === 'fetch') {
        return;
      }
    
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      const data = {};
      if ('transferSize' in entry) {
        data['Transfer Size'] = entry.transferSize;
      }
      if ('encodedBodySize' in entry) {
        data['Encoded Body Size'] = entry.encodedBodySize;
      }
      if ('decodedBodySize' in entry) {
        data['Decoded Body Size'] = entry.decodedBodySize;
      }
    
      const startTimestamp = timeOrigin + startTime;
      const endTimestamp = startTimestamp + duration;
    
      (0,_utils_js__WEBPACK_IMPORTED_MODULE_9__._startChild)(transaction, {
        description: resourceName,
        endTimestamp,
        op: entry.initiatorType ? `resource.${entry.initiatorType}` : 'resource.other',
        startTimestamp,
        data,
      });
    }
    
    /**
     * Capture the information of the user agent.
     */
    function _trackNavigator(transaction) {
      const navigator = _types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.navigator ;
      if (!navigator) {
        return;
      }
    
      // track network connectivity
      const connection = navigator.connection;
      if (connection) {
        if (connection.effectiveType) {
          transaction.setTag('effectiveConnectionType', connection.effectiveType);
        }
    
        if (connection.type) {
          transaction.setTag('connectionType', connection.type);
        }
    
        if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_9__.isMeasurementValue)(connection.rtt)) {
          _measurements['connection.rtt'] = { value: connection.rtt, unit: 'millisecond' };
        }
      }
    
      if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_9__.isMeasurementValue)(navigator.deviceMemory)) {
        transaction.setTag('deviceMemory', `${navigator.deviceMemory} GB`);
      }
    
      if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_9__.isMeasurementValue)(navigator.hardwareConcurrency)) {
        transaction.setTag('hardwareConcurrency', String(navigator.hardwareConcurrency));
      }
    }
    
    /** Add LCP / CLS data to transaction to allow debugging */
    function _tagMetricInfo(transaction) {
      if (_lcpEntry) {
        (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_5__.logger.log('[Measurements] Adding LCP Data');
    
        // Capture Properties of the LCP element that contributes to the LCP.
    
        if (_lcpEntry.element) {
          transaction.setTag('lcp.element', (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_11__.htmlTreeAsString)(_lcpEntry.element));
        }
    
        if (_lcpEntry.id) {
          transaction.setTag('lcp.id', _lcpEntry.id);
        }
    
        if (_lcpEntry.url) {
          // Trim URL to the first 200 characters.
          transaction.setTag('lcp.url', _lcpEntry.url.trim().slice(0, 200));
        }
    
        transaction.setTag('lcp.size', _lcpEntry.size);
      }
    
      // See: https://developer.mozilla.org/en-US/docs/Web/API/LayoutShift
      if (_clsEntry && _clsEntry.sources) {
        (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && _sentry_utils__WEBPACK_IMPORTED_MODULE_5__.logger.log('[Measurements] Adding CLS Data');
        _clsEntry.sources.forEach((source, index) =>
          transaction.setTag(`cls.source.${index + 1}`, (0,_sentry_utils__WEBPACK_IMPORTED_MODULE_11__.htmlTreeAsString)(source.node)),
        );
      }
    }
    
    
    //# sourceMappingURL=index.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "observe": () => (/* binding */ observe)
    /* harmony export */ });
    /**
     * Takes a performance entry type and a callback function, and creates a
     * `PerformanceObserver` instance that will observe the specified entry type
     * with buffering enabled and call the callback _for each entry_.
     *
     * This function also feature-detects entry support and wraps the logic in a
     * try/catch to avoid errors in unsupporting browsers.
     */
    const observe = (
      type,
      callback,
      opts,
    ) => {
      try {
        if (PerformanceObserver.supportedEntryTypes.includes(type)) {
          const po = new PerformanceObserver(list => {
            callback(list.getEntries() );
          });
          po.observe(
            Object.assign(
              {
                type,
                buffered: true,
              },
              opts || {},
            ) ,
          );
          return po;
        }
      } catch (e) {
        // Do nothing.
      }
      return;
    };
    
    
    //# sourceMappingURL=observe.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "onCLS": () => (/* binding */ onCLS)
    /* harmony export */ });
    
    /* harmony import */ var _lib_bindReporter_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1760);
    /* harmony import */ var _lib_initMetric_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1756);
    /* harmony import */ var _lib_observe_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1754);
    /* harmony import */ var _lib_onHidden_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1761);
    
    
    
    
    
    
    /*
     * Copyright 2020 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    /**
     * Calculates the [CLS](https://web.dev/cls/) value for the current page and
     * calls the `callback` function once the value is ready to be reported, along
     * with all `layout-shift` performance entries that were used in the metric
     * value calculation. The reported value is a `double` (corresponding to a
     * [layout shift score](https://web.dev/cls/#layout-shift-score)).
     *
     * If the `reportAllChanges` configuration option is set to `true`, the
     * `callback` function will be called as soon as the value is initially
     * determined as well as any time the value changes throughout the page
     * lifespan.
     *
     * _**Important:** CLS should be continually monitored for changes throughout
     * the entire lifespan of a page—including if the user returns to the page after
     * it's been hidden/backgrounded. However, since browsers often [will not fire
     * additional callbacks once the user has backgrounded a
     * page](https://developer.chrome.com/blog/page-lifecycle-api/#advice-hidden),
     * `callback` is always called when the page's visibility state changes to
     * hidden. As a result, the `callback` function might be called multiple times
     * during the same page load._
     */
    const onCLS = (onReport, opts = {}) => {
      const metric = (0,_lib_initMetric_js__WEBPACK_IMPORTED_MODULE_0__.initMetric)('CLS', 0);
      let report;
    
      let sessionValue = 0;
      let sessionEntries = [];
    
      // const handleEntries = (entries: Metric['entries']) => {
      const handleEntries = (entries) => {
        entries.forEach(entry => {
          // Only count layout shifts without recent user input.
          if (!entry.hadRecentInput) {
            const firstSessionEntry = sessionEntries[0];
            const lastSessionEntry = sessionEntries[sessionEntries.length - 1];
    
            // If the entry occurred less than 1 second after the previous entry and
            // less than 5 seconds after the first entry in the session, include the
            // entry in the current session. Otherwise, start a new session.
            if (
              sessionValue &&
              sessionEntries.length !== 0 &&
              entry.startTime - lastSessionEntry.startTime < 1000 &&
              entry.startTime - firstSessionEntry.startTime < 5000
            ) {
              sessionValue += entry.value;
              sessionEntries.push(entry);
            } else {
              sessionValue = entry.value;
              sessionEntries = [entry];
            }
    
            // If the current session value is larger than the current CLS value,
            // update CLS and the entries contributing to it.
            if (sessionValue > metric.value) {
              metric.value = sessionValue;
              metric.entries = sessionEntries;
              if (report) {
                report();
              }
            }
          }
        });
      };
    
      const po = (0,_lib_observe_js__WEBPACK_IMPORTED_MODULE_1__.observe)('layout-shift', handleEntries);
      if (po) {
        report = (0,_lib_bindReporter_js__WEBPACK_IMPORTED_MODULE_2__.bindReporter)(onReport, metric, opts.reportAllChanges);
    
        (0,_lib_onHidden_js__WEBPACK_IMPORTED_MODULE_3__.onHidden)(() => {
          handleEntries(po.takeRecords() );
          report(true);
        });
      }
    };
    
    
    //# sourceMappingURL=getCLS.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "initMetric": () => (/* binding */ initMetric)
    /* harmony export */ });
    
    /* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1751);
    /* harmony import */ var _generateUniqueID_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1759);
    /* harmony import */ var _getActivationStart_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1758);
    /* harmony import */ var _getNavigationEntry_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1757);
    
    
    
    
    
    
    /*
     * Copyright 2020 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    const initMetric = (name, value) => {
      const navEntry = (0,_getNavigationEntry_js__WEBPACK_IMPORTED_MODULE_0__.getNavigationEntry)();
      let navigationType = 'navigate';
    
      if (navEntry) {
        if (_types_js__WEBPACK_IMPORTED_MODULE_1__.WINDOW.document.prerendering || (0,_getActivationStart_js__WEBPACK_IMPORTED_MODULE_2__.getActivationStart)() > 0) {
          navigationType = 'prerender';
        } else {
          navigationType = navEntry.type.replace(/_/g, '-') ;
        }
      }
    
      return {
        name,
        value: typeof value === 'undefined' ? -1 : value,
        rating: 'good', // Will be updated if the value changes.
        delta: 0,
        entries: [],
        id: (0,_generateUniqueID_js__WEBPACK_IMPORTED_MODULE_3__.generateUniqueID)(),
        navigationType,
      };
    };
    
    
    //# sourceMappingURL=initMetric.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "getNavigationEntry": () => (/* binding */ getNavigationEntry)
    /* harmony export */ });
    
    /* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1751);
    
    
    
    /*
     * Copyright 2022 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    const getNavigationEntryFromPerformanceTiming = () => {
      // eslint-disable-next-line deprecation/deprecation
      const timing = _types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.performance.timing;
      // eslint-disable-next-line deprecation/deprecation
      const type = _types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.performance.navigation.type;
    
      const navigationEntry = {
        entryType: 'navigation',
        startTime: 0,
        type: type == 2 ? 'back_forward' : type === 1 ? 'reload' : 'navigate',
      };
    
      for (const key in timing) {
        if (key !== 'navigationStart' && key !== 'toJSON') {
          navigationEntry[key] = Math.max((timing[key ] ) - timing.navigationStart, 0);
        }
      }
      return navigationEntry ;
    };
    
    const getNavigationEntry = () => {
      if (_types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.__WEB_VITALS_POLYFILL__) {
        return (
          _types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.performance &&
          ((performance.getEntriesByType && performance.getEntriesByType('navigation')[0]) ||
            getNavigationEntryFromPerformanceTiming())
        );
      } else {
        return _types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.performance && performance.getEntriesByType && performance.getEntriesByType('navigation')[0];
      }
    };
    
    
    //# sourceMappingURL=getNavigationEntry.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "getActivationStart": () => (/* binding */ getActivationStart)
    /* harmony export */ });
    
    /* harmony import */ var _getNavigationEntry_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1757);
    
    
    
    /*
     * Copyright 2022 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    const getActivationStart = () => {
      const navEntry = (0,_getNavigationEntry_js__WEBPACK_IMPORTED_MODULE_0__.getNavigationEntry)();
      return (navEntry && navEntry.activationStart) || 0;
    };
    
    
    //# sourceMappingURL=getActivationStart.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "generateUniqueID": () => (/* binding */ generateUniqueID)
    /* harmony export */ });
    /*
     * Copyright 2020 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    /**
     * Performantly generate a unique, 30-char string by combining a version
     * number, the current timestamp with a 13-digit number integer.
     * @return {string}
     */
    const generateUniqueID = () => {
      return `v3-${Date.now()}-${Math.floor(Math.random() * (9e12 - 1)) + 1e12}`;
    };
    
    
    //# sourceMappingURL=generateUniqueID.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "bindReporter": () => (/* binding */ bindReporter)
    /* harmony export */ });
    const bindReporter = (
      callback,
      metric,
      reportAllChanges,
    ) => {
      let prevValue;
      let delta;
      return (forceReport) => {
        if (metric.value >= 0) {
          if (forceReport || reportAllChanges) {
            delta = metric.value - (prevValue || 0);
    
            // Report the metric if there's a non-zero delta or if no previous
            // value exists (which can happen in the case of the document becoming
            // hidden when the metric value is 0).
            // See: https://github.com/GoogleChrome/web-vitals/issues/14
            if (delta || prevValue === undefined) {
              prevValue = metric.value;
              metric.delta = delta;
              callback(metric);
            }
          }
        }
      };
    };
    
    
    //# sourceMappingURL=bindReporter.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "onHidden": () => (/* binding */ onHidden)
    /* harmony export */ });
    
    /* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1751);
    
    
    
    /*
     * Copyright 2020 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    const onHidden = (cb, once) => {
      const onHiddenOrPageHide = (event) => {
        if (event.type === 'pagehide' || _types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.document.visibilityState === 'hidden') {
          cb(event);
          if (once) {
            removeEventListener('visibilitychange', onHiddenOrPageHide, true);
            removeEventListener('pagehide', onHiddenOrPageHide, true);
          }
        }
      };
      addEventListener('visibilitychange', onHiddenOrPageHide, true);
      // Some browsers have buggy implementations of visibilitychange,
      // so we use pagehide in addition, just to be safe.
      addEventListener('pagehide', onHiddenOrPageHide, true);
    };
    
    
    //# sourceMappingURL=onHidden.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "onLCP": () => (/* binding */ onLCP)
    /* harmony export */ });
    
    /* harmony import */ var _lib_bindReporter_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1760);
    /* harmony import */ var _lib_getActivationStart_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1758);
    /* harmony import */ var _lib_getVisibilityWatcher_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1763);
    /* harmony import */ var _lib_initMetric_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1756);
    /* harmony import */ var _lib_observe_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1754);
    /* harmony import */ var _lib_onHidden_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1761);
    
    
    
    
    
    
    
    
    /*
     * Copyright 2020 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    const reportedMetricIDs = {};
    
    /**
     * Calculates the [LCP](https://web.dev/lcp/) value for the current page and
     * calls the `callback` function once the value is ready (along with the
     * relevant `largest-contentful-paint` performance entry used to determine the
     * value). The reported value is a `DOMHighResTimeStamp`.
     *
     * If the `reportAllChanges` configuration option is set to `true`, the
     * `callback` function will be called any time a new `largest-contentful-paint`
     * performance entry is dispatched, or once the final value of the metric has
     * been determined.
     */
    const onLCP = (onReport, opts = {}) => {
      const visibilityWatcher = (0,_lib_getVisibilityWatcher_js__WEBPACK_IMPORTED_MODULE_0__.getVisibilityWatcher)();
      const metric = (0,_lib_initMetric_js__WEBPACK_IMPORTED_MODULE_1__.initMetric)('LCP');
      let report;
    
      const handleEntries = (entries) => {
        const lastEntry = entries[entries.length - 1] ;
        if (lastEntry) {
          // The startTime attribute returns the value of the renderTime if it is
          // not 0, and the value of the loadTime otherwise. The activationStart
          // reference is used because LCP should be relative to page activation
          // rather than navigation start if the page was prerendered.
          const value = Math.max(lastEntry.startTime - (0,_lib_getActivationStart_js__WEBPACK_IMPORTED_MODULE_2__.getActivationStart)(), 0);
    
          // Only report if the page wasn't hidden prior to LCP.
          if (value < visibilityWatcher.firstHiddenTime) {
            metric.value = value;
            metric.entries = [lastEntry];
            report();
          }
        }
      };
    
      const po = (0,_lib_observe_js__WEBPACK_IMPORTED_MODULE_3__.observe)('largest-contentful-paint', handleEntries);
    
      if (po) {
        report = (0,_lib_bindReporter_js__WEBPACK_IMPORTED_MODULE_4__.bindReporter)(onReport, metric, opts.reportAllChanges);
    
        const stopListening = () => {
          if (!reportedMetricIDs[metric.id]) {
            handleEntries(po.takeRecords() );
            po.disconnect();
            reportedMetricIDs[metric.id] = true;
            report(true);
          }
        };
    
        // Stop listening after input. Note: while scrolling is an input that
        // stop LCP observation, it's unreliable since it can be programmatically
        // generated. See: https://github.com/GoogleChrome/web-vitals/issues/75
        ['keydown', 'click'].forEach(type => {
          addEventListener(type, stopListening, { once: true, capture: true });
        });
    
        (0,_lib_onHidden_js__WEBPACK_IMPORTED_MODULE_5__.onHidden)(stopListening, true);
      }
    };
    
    
    //# sourceMappingURL=getLCP.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "getVisibilityWatcher": () => (/* binding */ getVisibilityWatcher)
    /* harmony export */ });
    
    /* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1751);
    /* harmony import */ var _onHidden_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1761);
    
    
    
    
    /*
     * Copyright 2020 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    let firstHiddenTime = -1;
    
    const initHiddenTime = () => {
      // If the document is hidden and not prerendering, assume it was always
      // hidden and the page was loaded in the background.
      return _types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.document.visibilityState === 'hidden' && !_types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.document.prerendering ? 0 : Infinity;
    };
    
    const trackChanges = () => {
      // Update the time if/when the document becomes hidden.
      (0,_onHidden_js__WEBPACK_IMPORTED_MODULE_1__.onHidden)(({ timeStamp }) => {
        firstHiddenTime = timeStamp;
      }, true);
    };
    
    const getVisibilityWatcher = (
    
    ) => {
      if (firstHiddenTime < 0) {
        // If the document is hidden when this code runs, assume it was hidden
        // since navigation start. This isn't a perfect heuristic, but it's the
        // best we can do until an API is available to support querying past
        // visibilityState.
        firstHiddenTime = initHiddenTime();
        trackChanges();
      }
      return {
        get firstHiddenTime() {
          return firstHiddenTime;
        },
      };
    };
    
    
    //# sourceMappingURL=getVisibilityWatcher.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "onFID": () => (/* binding */ onFID)
    /* harmony export */ });
    
    /* harmony import */ var _lib_bindReporter_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1760);
    /* harmony import */ var _lib_getVisibilityWatcher_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1763);
    /* harmony import */ var _lib_initMetric_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1756);
    /* harmony import */ var _lib_observe_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1754);
    /* harmony import */ var _lib_onHidden_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1761);
    
    
    
    
    
    
    
    /*
     * Copyright 2020 Google LLC
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *     https://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     */
    
    /**
     * Calculates the [FID](https://web.dev/fid/) value for the current page and
     * calls the `callback` function once the value is ready, along with the
     * relevant `first-input` performance entry used to determine the value. The
     * reported value is a `DOMHighResTimeStamp`.
     *
     * _**Important:** since FID is only reported after the user interacts with the
     * page, it's possible that it will not be reported for some page loads._
     */
    const onFID = (onReport, opts = {}) => {
      const visibilityWatcher = (0,_lib_getVisibilityWatcher_js__WEBPACK_IMPORTED_MODULE_0__.getVisibilityWatcher)();
      const metric = (0,_lib_initMetric_js__WEBPACK_IMPORTED_MODULE_1__.initMetric)('FID');
      // eslint-disable-next-line prefer-const
      let report;
    
      const handleEntry = (entry) => {
        // Only report if the page wasn't hidden prior to the first input.
        if (entry.startTime < visibilityWatcher.firstHiddenTime) {
          metric.value = entry.processingStart - entry.startTime;
          metric.entries.push(entry);
          report(true);
        }
      };
    
      const handleEntries = (entries) => {
        (entries ).forEach(handleEntry);
      };
    
      const po = (0,_lib_observe_js__WEBPACK_IMPORTED_MODULE_2__.observe)('first-input', handleEntries);
      report = (0,_lib_bindReporter_js__WEBPACK_IMPORTED_MODULE_3__.bindReporter)(onReport, metric, opts.reportAllChanges);
    
      if (po) {
        (0,_lib_onHidden_js__WEBPACK_IMPORTED_MODULE_4__.onHidden)(() => {
          handleEntries(po.takeRecords() );
          po.disconnect();
        }, true);
      }
    };
    
    
    //# sourceMappingURL=getFID.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "_startChild": () => (/* binding */ _startChild),
    /* harmony export */   "isMeasurementValue": () => (/* binding */ isMeasurementValue)
    /* harmony export */ });
    /**
     * Checks if a given value is a valid measurement value.
     */
    function isMeasurementValue(value) {
      return typeof value === 'number' && isFinite(value);
    }
    
    /**
     * Helper function to start child on transactions. This function will make sure that the transaction will
     * use the start timestamp of the created child span if it is earlier than the transactions actual
     * start timestamp.
     */
    function _startChild(transaction, { startTimestamp, ...ctx }) {
      if (startTimestamp && transaction.startTimestamp > startTimestamp) {
        transaction.startTimestamp = startTimestamp;
      }
    
      return transaction.startChild({
        startTimestamp,
        ...ctx,
      });
    }
    
    
    //# sourceMappingURL=utils.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";
    __webpack_require__.r(__webpack_exports__);
    /* harmony export */ __webpack_require__.d(__webpack_exports__, {
    /* harmony export */   "registerBackgroundTabDetection": () => (/* binding */ registerBackgroundTabDetection)
    /* harmony export */ });
    
    /* harmony import */ var _sentry_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1653);
    /* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1733);
    /* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1751);
    
    
    
    
    
    /**
     * Add a listener that cancels and finishes a transaction when the global
     * document is hidden.
     */
    function registerBackgroundTabDetection() {
      if (_types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW && _types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.document) {
        _types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.document.addEventListener('visibilitychange', () => {
          const activeTransaction = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.getActiveTransaction)() ;
          if (_types_js__WEBPACK_IMPORTED_MODULE_0__.WINDOW.document.hidden && activeTransaction) {
            const statusType = 'cancelled';
    
            (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&
              _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.log(
                `[Tracing] Transaction: ${statusType} -> since tab moved to the background, op: ${activeTransaction.op}`,
              );
            // We should not set status if it is already set, this prevent important statuses like
            // error or data loss from being overwritten on transaction.
            if (!activeTransaction.status) {
              activeTransaction.setStatus(statusType);
            }
            activeTransaction.setTag('visibilitychange', 'document.hidden');
            activeTransaction.finish();
          }
        });
      } else {
        (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) &&
          _sentry_utils__WEBPACK_IMPORTED_MODULE_2__.logger.warn('[Tracing] Could not set up background tab detection due to lack of global document');
      }
    }
    
    
    //# sourceMappingURL=backgroundtab.js.map
    
    
    /***/ }),
    
    /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
    
    "use strict";