New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

perfume.js

Package Overview
Dependencies
Maintainers
1
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

perfume.js - npm Package Compare versions

Comparing version 5.0.0-rc.9 to 5.0.0-rc.10

dist/es/cumulativeLayoutShift.js

8

CHANGELOG.md
# Changelog
## 5.0.0-rc.10 (2020-3-26)
* **refactor:** reduced library kb part V & simplified estimateStorage metric result
### Breaking Changes
Simplified EstimateStorage values, to help reduce library size.
## 5.0.0-rc.9 (2020-3-25)

@@ -4,0 +12,0 @@

46

dist/es/observe.js

@@ -1,21 +0,33 @@

import { logWarn } from './log';
/**
* PerformanceObserver subscribes to performance events as they happen
* and respond to them asynchronously.
*/
export var po = function (eventType, cb) {
try {
var perfObserver = new PerformanceObserver(function (entryList) {
var performanceEntries = entryList.getEntries();
cb(performanceEntries);
});
// Retrieve buffered events and subscribe to newer events for Paint Timing
perfObserver.observe({ type: eventType, buffered: true });
return perfObserver;
import { config } from './config';
import { initLayoutShift } from './cumulativeLayoutShift';
import { initFirstInputDelay } from './firstInput';
import { logMetric } from './log';
import { cls, clsMetricName, lcp, lcpMetricName } from './metrics';
import { perfObservers } from './observeInstances';
import { initFirstPaint, initLargestContentfulPaint } from './paint';
import { po } from './performanceObserver';
import { initResourceTiming } from './resourceTiming';
export var initPerformanceObserver = function () {
perfObservers.fcp = po('paint', initFirstPaint);
// FID needs to be initialized as soon as Perfume is available
// DataConsumption resolves after FID is triggered
perfObservers.fid = po('first-input', initFirstInputDelay);
perfObservers.lcp = po('largest-contentful-paint', initLargestContentfulPaint);
// Collects KB information related to resources on the page
if (config.resourceTiming) {
po('resource', initResourceTiming);
}
catch (e) {
logWarn(e);
perfObservers.cls = po('layout-shift', initLayoutShift);
};
export var disconnectPerfObserversHidden = function () {
if (perfObservers.lcp) {
logMetric(lcp.value, lcpMetricName + "UntilHidden");
perfObservers.lcp.disconnect();
}
return null;
if (perfObservers.cls) {
perfObservers.cls.takeRecords();
logMetric(cls.value, clsMetricName + "UntilHidden", '');
perfObservers.cls.disconnect();
}
};
//# sourceMappingURL=observe.js.map

@@ -8,4 +8,5 @@ import { config } from './config';

import { isPerformanceObserverSupported, isPerformanceSupported, } from './isSupported';
import { log, logData, logMetric, logWarn } from './log';
import { po } from './observe';
import { log, logData, logWarn } from './log';
import { performanceMeasure } from './measure';
import { disconnectPerfObserversHidden, initPerformanceObserver, } from './observe';
import { onVisibilityChange, visibility } from './onVisibilityChange';

@@ -15,7 +16,3 @@ import { reportPerf } from './reportPerf';

import { pushTask } from './utils';
// Have private variable outside the class,
// helps reduce the library size
var fcp = 0;
var clsScore = 0;
var lcp = 0;
var logPrefixRecording = 'Recording already';
var Perfume = /** @class */ (function () {

@@ -25,17 +22,4 @@ function Perfume(options) {

this.copyright = '© 2020 Leonardo Zizzamia';
this.version = '5.0.0-rc.9';
this.logPrefixRecording = 'Recording already';
this.version = '5.0.0-rc.10';
this.metrics = {};
this.perfObservers = {};
this.perfResourceTiming = {
beacon: 0,
css: 0,
fetch: 0,
img: 0,
other: 0,
script: 0,
total: 0,
xmlhttprequest: 0,
};
this.totalBlockingTimeScore = 0;
// Extend default config with external options

@@ -52,6 +36,6 @@ config.resourceTiming = !!options.resourceTiming;

if (isPerformanceObserverSupported()) {
this.initPerformanceObserver();
initPerformanceObserver();
}
// Init visibilitychange listener
onVisibilityChange(this.disconnectPerfObserversHidden);
onVisibilityChange(disconnectPerfObserversHidden);
// Log Navigation Timing

@@ -72,3 +56,3 @@ logData('navigationTiming', getNavigationTiming());

if (this.metrics[markName]) {
logWarn(this.logPrefixRecording + " started.");
logWarn(logPrefixRecording + " started.");
return;

@@ -91,3 +75,3 @@ }

if (!this.metrics[markName]) {
logWarn(this.logPrefixRecording + " stopped.");
logWarn(logPrefixRecording + " stopped.");
return;

@@ -98,3 +82,3 @@ }

// Get duration and change it to a two decimal value
var durationByMetric = this.performanceMeasure(markName);
var durationByMetric = performanceMeasure(markName);
var duration2Decimal = parseFloat(durationByMetric.toFixed(2));

@@ -139,204 +123,2 @@ delete this.metrics[markName];

};
Perfume.prototype.digestFirstInputDelayEntries = function (performanceEntries) {
this.performanceObserverCb({
performanceEntries: performanceEntries,
measureName: 'firstInputDelay',
valueLog: 'duration',
});
this.disconnectPerfObservers(lcp, clsScore);
this.disconnectDataConsumption();
this.disconnecTotalBlockingTime();
};
Perfume.prototype.disconnectDataConsumption = function () {
if (!this.dataConsumptionTimeout) {
return;
}
clearTimeout(this.dataConsumptionTimeout);
this.dataConsumptionTimeout = undefined;
logData('dataConsumption', this.perfResourceTiming);
};
Perfume.prototype.disconnectPerfObservers = function (lcpValue, clsScoreValue) {
if (this.perfObservers.lcp && lcpValue) {
logMetric(lcpValue, 'largestContentfulPaint');
}
if (this.perfObservers.cls && clsScoreValue > 0) {
this.perfObservers.cls.takeRecords();
logMetric(clsScoreValue, 'cumulativeLayoutShift', '');
}
// TBT by FID
if (this.perfObservers.tbt && this.totalBlockingTimeScore) {
logMetric(this.totalBlockingTimeScore, 'totalBlockingTime');
}
};
Perfume.prototype.disconnectPerfObserversHidden = function () {
if (this.perfObservers.lcp && lcp) {
logMetric(lcp, 'largestContentfulPaintUntilHidden');
this.perfObservers.lcp.disconnect();
}
if (this.perfObservers.cls && clsScore > 0) {
this.perfObservers.cls.takeRecords();
logMetric(clsScore, 'cumulativeLayoutShiftUntilHidden', '');
this.perfObservers.cls.disconnect();
}
};
Perfume.prototype.disconnecTotalBlockingTime = function () {
var _this = this;
// TBT with 5 second delay after FID
setTimeout(function () {
if (_this.perfObservers.tbt && _this.totalBlockingTimeScore) {
logMetric(_this.totalBlockingTimeScore, 'totalBlockingTime5S');
}
}, 5000);
// TBT with 10 second delay after FID
setTimeout(function () {
if (_this.perfObservers.tbt) {
if (_this.totalBlockingTimeScore) {
logMetric(_this.totalBlockingTimeScore, 'totalBlockingTime10S');
}
_this.perfObservers.tbt.disconnect();
}
}, 10000);
};
Perfume.prototype.initFirstInputDelay = function () {
this.perfObservers.fid = po('first-input', this.digestFirstInputDelayEntries.bind(this));
};
/**
* First Paint is essentially the paint after which
* the biggest above-the-fold layout change has happened.
*/
Perfume.prototype.initFirstPaint = function () {
var _this = this;
this.perfObservers.fcp = po('paint', function (performanceEntries) {
_this.performanceObserverCb({
performanceEntries: performanceEntries,
entryName: 'first-paint',
measureName: 'firstPaint',
valueLog: 'startTime',
});
_this.performanceObserverCb({
performanceEntries: performanceEntries,
entryName: 'first-contentful-paint',
measureName: 'firstContentfulPaint',
valueLog: 'startTime',
});
});
};
Perfume.prototype.initLargestContentfulPaint = function () {
this.perfObservers.lcp = po('largest-contentful-paint', function (performanceEntries) {
var lastEntry = performanceEntries.pop();
if (lastEntry) {
lcp = lastEntry.renderTime || lastEntry.loadTime;
}
});
};
/**
* Detects new layout shift occurrences and updates the
* `cumulativeLayoutShiftScore` variable.
*/
Perfume.prototype.initLayoutShift = function () {
this.perfObservers.cls = po('layout-shift', function (performanceEntries) {
var lastEntry = performanceEntries.pop();
// Only count layout shifts without recent user input.
if (lastEntry && !lastEntry.hadRecentInput && lastEntry.value) {
clsScore += lastEntry.value;
}
});
};
Perfume.prototype.initPerformanceObserver = function () {
this.initFirstPaint();
// FID needs to be initialized as soon as Perfume is available
// DataConsumption resolves after FID is triggered
this.initFirstInputDelay();
this.initLargestContentfulPaint();
// Collects KB information related to resources on the page
if (config.resourceTiming) {
this.initResourceTiming();
}
this.initLayoutShift();
};
Perfume.prototype.initResourceTiming = function () {
var _this = this;
po('resource', function (performanceEntries) {
_this.performanceObserverResourceCb({
performanceEntries: performanceEntries,
});
});
this.dataConsumptionTimeout = setTimeout(function () {
_this.disconnectDataConsumption();
}, 15000);
};
Perfume.prototype.initTotalBlockingTime = function () {
var _this = this;
this.perfObservers.tbt = po('longtask', function (performanceEntries) {
_this.performanceObserverTBTCb({
performanceEntries: performanceEntries,
});
});
};
/**
* Get the duration of the timing metric or -1 if there a measurement has
* not been made by the User Timing API
*/
Perfume.prototype.getDurationByMetric = function (measureName) {
var performanceEntries = WP.getEntriesByName(measureName);
var entry = performanceEntries[performanceEntries.length - 1];
if (entry && entry.entryType === 'measure') {
return entry.duration;
}
return -1;
};
Perfume.prototype.performanceMeasure = function (measureName) {
var startMark = "mark_" + measureName + "_start";
var endMark = "mark_" + measureName + "_end";
WP.measure(measureName, startMark, endMark);
return this.getDurationByMetric(measureName);
};
/**
* Logging Performance Paint Timing
*/
Perfume.prototype.performanceObserverCb = function (options) {
var _this = this;
options.performanceEntries.forEach(function (performanceEntry) {
if (!options.entryName ||
(options.entryName && performanceEntry.name === options.entryName)) {
logMetric(performanceEntry[options.valueLog], options.measureName);
}
if (_this.perfObservers.fcp &&
performanceEntry.name === 'first-contentful-paint') {
fcp = performanceEntry.startTime;
_this.initTotalBlockingTime();
_this.perfObservers.fcp.disconnect();
}
});
if (this.perfObservers.fid && options.measureName === 'firstInputDelay') {
this.perfObservers.fid.disconnect();
}
};
Perfume.prototype.performanceObserverResourceCb = function (options) {
var _this = this;
options.performanceEntries.forEach(function (performanceEntry) {
if (config.resourceTiming) {
logData('resourceTiming', performanceEntry);
}
if (performanceEntry.decodedBodySize &&
performanceEntry.initiatorType) {
var bodySize = performanceEntry.decodedBodySize / 1000;
_this.perfResourceTiming[performanceEntry.initiatorType] += bodySize;
_this.perfResourceTiming.total += bodySize;
}
});
};
Perfume.prototype.performanceObserverTBTCb = function (options) {
var _this = this;
options.performanceEntries.forEach(function (performanceEntry) {
if (performanceEntry.name !== 'self' ||
performanceEntry.startTime < fcp) {
return;
}
var blockingTime = performanceEntry.duration - 50;
if (blockingTime) {
_this.totalBlockingTimeScore += blockingTime;
}
});
};
return Perfume;

@@ -343,0 +125,0 @@ }());

@@ -20,9 +20,9 @@ import { WN } from './constants';

logData('storageEstimate', {
storageEstimateQuota: convertToKB(storageInfo.quota),
storageEstimateUsage: convertToKB(storageInfo.usage),
storageEstimateCaches: convertToKB(estimateUsageDetails.caches),
storageEstimateIndexedDB: convertToKB(estimateUsageDetails.indexedDB),
storageEstimatSW: convertToKB(estimateUsageDetails.serviceWorkerRegistrations),
quota: convertToKB(storageInfo.quota),
usage: convertToKB(storageInfo.usage),
caches: convertToKB(estimateUsageDetails.caches),
indexedDB: convertToKB(estimateUsageDetails.indexedDB),
serviceWorker: convertToKB(estimateUsageDetails.serviceWorkerRegistrations),
});
};
//# sourceMappingURL=storageEstimate.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var config_1 = require("./config");
var cumulativeLayoutShift_1 = require("./cumulativeLayoutShift");
var firstInput_1 = require("./firstInput");
var log_1 = require("./log");
/**
* PerformanceObserver subscribes to performance events as they happen
* and respond to them asynchronously.
*/
exports.po = function (eventType, cb) {
try {
var perfObserver = new PerformanceObserver(function (entryList) {
var performanceEntries = entryList.getEntries();
cb(performanceEntries);
});
// Retrieve buffered events and subscribe to newer events for Paint Timing
perfObserver.observe({ type: eventType, buffered: true });
return perfObserver;
var metrics_1 = require("./metrics");
var observeInstances_1 = require("./observeInstances");
var paint_1 = require("./paint");
var performanceObserver_1 = require("./performanceObserver");
var resourceTiming_1 = require("./resourceTiming");
exports.initPerformanceObserver = function () {
observeInstances_1.perfObservers.fcp = performanceObserver_1.po('paint', paint_1.initFirstPaint);
// FID needs to be initialized as soon as Perfume is available
// DataConsumption resolves after FID is triggered
observeInstances_1.perfObservers.fid = performanceObserver_1.po('first-input', firstInput_1.initFirstInputDelay);
observeInstances_1.perfObservers.lcp = performanceObserver_1.po('largest-contentful-paint', paint_1.initLargestContentfulPaint);
// Collects KB information related to resources on the page
if (config_1.config.resourceTiming) {
performanceObserver_1.po('resource', resourceTiming_1.initResourceTiming);
}
catch (e) {
log_1.logWarn(e);
observeInstances_1.perfObservers.cls = performanceObserver_1.po('layout-shift', cumulativeLayoutShift_1.initLayoutShift);
};
exports.disconnectPerfObserversHidden = function () {
if (observeInstances_1.perfObservers.lcp) {
log_1.logMetric(metrics_1.lcp.value, metrics_1.lcpMetricName + "UntilHidden");
observeInstances_1.perfObservers.lcp.disconnect();
}
return null;
if (observeInstances_1.perfObservers.cls) {
observeInstances_1.perfObservers.cls.takeRecords();
log_1.logMetric(metrics_1.cls.value, metrics_1.clsMetricName + "UntilHidden", '');
observeInstances_1.perfObservers.cls.disconnect();
}
};
//# sourceMappingURL=observe.js.map

@@ -11,2 +11,3 @@ "use strict";

var log_1 = require("./log");
var measure_1 = require("./measure");
var observe_1 = require("./observe");

@@ -17,7 +18,3 @@ var onVisibilityChange_1 = require("./onVisibilityChange");

var utils_1 = require("./utils");
// Have private variable outside the class,
// helps reduce the library size
var fcp = 0;
var clsScore = 0;
var lcp = 0;
var logPrefixRecording = 'Recording already';
var Perfume = /** @class */ (function () {

@@ -27,17 +24,4 @@ function Perfume(options) {

this.copyright = '© 2020 Leonardo Zizzamia';
this.version = '5.0.0-rc.9';
this.logPrefixRecording = 'Recording already';
this.version = '5.0.0-rc.10';
this.metrics = {};
this.perfObservers = {};
this.perfResourceTiming = {
beacon: 0,
css: 0,
fetch: 0,
img: 0,
other: 0,
script: 0,
total: 0,
xmlhttprequest: 0,
};
this.totalBlockingTimeScore = 0;
// Extend default config with external options

@@ -54,6 +38,6 @@ config_1.config.resourceTiming = !!options.resourceTiming;

if (isSupported_1.isPerformanceObserverSupported()) {
this.initPerformanceObserver();
observe_1.initPerformanceObserver();
}
// Init visibilitychange listener
onVisibilityChange_1.onVisibilityChange(this.disconnectPerfObserversHidden);
onVisibilityChange_1.onVisibilityChange(observe_1.disconnectPerfObserversHidden);
// Log Navigation Timing

@@ -74,3 +58,3 @@ log_1.logData('navigationTiming', getNavigationTiming_1.getNavigationTiming());

if (this.metrics[markName]) {
log_1.logWarn(this.logPrefixRecording + " started.");
log_1.logWarn(logPrefixRecording + " started.");
return;

@@ -93,3 +77,3 @@ }

if (!this.metrics[markName]) {
log_1.logWarn(this.logPrefixRecording + " stopped.");
log_1.logWarn(logPrefixRecording + " stopped.");
return;

@@ -100,3 +84,3 @@ }

// Get duration and change it to a two decimal value
var durationByMetric = this.performanceMeasure(markName);
var durationByMetric = measure_1.performanceMeasure(markName);
var duration2Decimal = parseFloat(durationByMetric.toFixed(2));

@@ -141,204 +125,2 @@ delete this.metrics[markName];

};
Perfume.prototype.digestFirstInputDelayEntries = function (performanceEntries) {
this.performanceObserverCb({
performanceEntries: performanceEntries,
measureName: 'firstInputDelay',
valueLog: 'duration',
});
this.disconnectPerfObservers(lcp, clsScore);
this.disconnectDataConsumption();
this.disconnecTotalBlockingTime();
};
Perfume.prototype.disconnectDataConsumption = function () {
if (!this.dataConsumptionTimeout) {
return;
}
clearTimeout(this.dataConsumptionTimeout);
this.dataConsumptionTimeout = undefined;
log_1.logData('dataConsumption', this.perfResourceTiming);
};
Perfume.prototype.disconnectPerfObservers = function (lcpValue, clsScoreValue) {
if (this.perfObservers.lcp && lcpValue) {
log_1.logMetric(lcpValue, 'largestContentfulPaint');
}
if (this.perfObservers.cls && clsScoreValue > 0) {
this.perfObservers.cls.takeRecords();
log_1.logMetric(clsScoreValue, 'cumulativeLayoutShift', '');
}
// TBT by FID
if (this.perfObservers.tbt && this.totalBlockingTimeScore) {
log_1.logMetric(this.totalBlockingTimeScore, 'totalBlockingTime');
}
};
Perfume.prototype.disconnectPerfObserversHidden = function () {
if (this.perfObservers.lcp && lcp) {
log_1.logMetric(lcp, 'largestContentfulPaintUntilHidden');
this.perfObservers.lcp.disconnect();
}
if (this.perfObservers.cls && clsScore > 0) {
this.perfObservers.cls.takeRecords();
log_1.logMetric(clsScore, 'cumulativeLayoutShiftUntilHidden', '');
this.perfObservers.cls.disconnect();
}
};
Perfume.prototype.disconnecTotalBlockingTime = function () {
var _this = this;
// TBT with 5 second delay after FID
setTimeout(function () {
if (_this.perfObservers.tbt && _this.totalBlockingTimeScore) {
log_1.logMetric(_this.totalBlockingTimeScore, 'totalBlockingTime5S');
}
}, 5000);
// TBT with 10 second delay after FID
setTimeout(function () {
if (_this.perfObservers.tbt) {
if (_this.totalBlockingTimeScore) {
log_1.logMetric(_this.totalBlockingTimeScore, 'totalBlockingTime10S');
}
_this.perfObservers.tbt.disconnect();
}
}, 10000);
};
Perfume.prototype.initFirstInputDelay = function () {
this.perfObservers.fid = observe_1.po('first-input', this.digestFirstInputDelayEntries.bind(this));
};
/**
* First Paint is essentially the paint after which
* the biggest above-the-fold layout change has happened.
*/
Perfume.prototype.initFirstPaint = function () {
var _this = this;
this.perfObservers.fcp = observe_1.po('paint', function (performanceEntries) {
_this.performanceObserverCb({
performanceEntries: performanceEntries,
entryName: 'first-paint',
measureName: 'firstPaint',
valueLog: 'startTime',
});
_this.performanceObserverCb({
performanceEntries: performanceEntries,
entryName: 'first-contentful-paint',
measureName: 'firstContentfulPaint',
valueLog: 'startTime',
});
});
};
Perfume.prototype.initLargestContentfulPaint = function () {
this.perfObservers.lcp = observe_1.po('largest-contentful-paint', function (performanceEntries) {
var lastEntry = performanceEntries.pop();
if (lastEntry) {
lcp = lastEntry.renderTime || lastEntry.loadTime;
}
});
};
/**
* Detects new layout shift occurrences and updates the
* `cumulativeLayoutShiftScore` variable.
*/
Perfume.prototype.initLayoutShift = function () {
this.perfObservers.cls = observe_1.po('layout-shift', function (performanceEntries) {
var lastEntry = performanceEntries.pop();
// Only count layout shifts without recent user input.
if (lastEntry && !lastEntry.hadRecentInput && lastEntry.value) {
clsScore += lastEntry.value;
}
});
};
Perfume.prototype.initPerformanceObserver = function () {
this.initFirstPaint();
// FID needs to be initialized as soon as Perfume is available
// DataConsumption resolves after FID is triggered
this.initFirstInputDelay();
this.initLargestContentfulPaint();
// Collects KB information related to resources on the page
if (config_1.config.resourceTiming) {
this.initResourceTiming();
}
this.initLayoutShift();
};
Perfume.prototype.initResourceTiming = function () {
var _this = this;
observe_1.po('resource', function (performanceEntries) {
_this.performanceObserverResourceCb({
performanceEntries: performanceEntries,
});
});
this.dataConsumptionTimeout = setTimeout(function () {
_this.disconnectDataConsumption();
}, 15000);
};
Perfume.prototype.initTotalBlockingTime = function () {
var _this = this;
this.perfObservers.tbt = observe_1.po('longtask', function (performanceEntries) {
_this.performanceObserverTBTCb({
performanceEntries: performanceEntries,
});
});
};
/**
* Get the duration of the timing metric or -1 if there a measurement has
* not been made by the User Timing API
*/
Perfume.prototype.getDurationByMetric = function (measureName) {
var performanceEntries = constants_1.WP.getEntriesByName(measureName);
var entry = performanceEntries[performanceEntries.length - 1];
if (entry && entry.entryType === 'measure') {
return entry.duration;
}
return -1;
};
Perfume.prototype.performanceMeasure = function (measureName) {
var startMark = "mark_" + measureName + "_start";
var endMark = "mark_" + measureName + "_end";
constants_1.WP.measure(measureName, startMark, endMark);
return this.getDurationByMetric(measureName);
};
/**
* Logging Performance Paint Timing
*/
Perfume.prototype.performanceObserverCb = function (options) {
var _this = this;
options.performanceEntries.forEach(function (performanceEntry) {
if (!options.entryName ||
(options.entryName && performanceEntry.name === options.entryName)) {
log_1.logMetric(performanceEntry[options.valueLog], options.measureName);
}
if (_this.perfObservers.fcp &&
performanceEntry.name === 'first-contentful-paint') {
fcp = performanceEntry.startTime;
_this.initTotalBlockingTime();
_this.perfObservers.fcp.disconnect();
}
});
if (this.perfObservers.fid && options.measureName === 'firstInputDelay') {
this.perfObservers.fid.disconnect();
}
};
Perfume.prototype.performanceObserverResourceCb = function (options) {
var _this = this;
options.performanceEntries.forEach(function (performanceEntry) {
if (config_1.config.resourceTiming) {
log_1.logData('resourceTiming', performanceEntry);
}
if (performanceEntry.decodedBodySize &&
performanceEntry.initiatorType) {
var bodySize = performanceEntry.decodedBodySize / 1000;
_this.perfResourceTiming[performanceEntry.initiatorType] += bodySize;
_this.perfResourceTiming.total += bodySize;
}
});
};
Perfume.prototype.performanceObserverTBTCb = function (options) {
var _this = this;
options.performanceEntries.forEach(function (performanceEntry) {
if (performanceEntry.name !== 'self' ||
performanceEntry.startTime < fcp) {
return;
}
var blockingTime = performanceEntry.duration - 50;
if (blockingTime) {
_this.totalBlockingTimeScore += blockingTime;
}
});
};
return Perfume;

@@ -345,0 +127,0 @@ }());

@@ -22,9 +22,9 @@ "use strict";

log_1.logData('storageEstimate', {
storageEstimateQuota: utils_1.convertToKB(storageInfo.quota),
storageEstimateUsage: utils_1.convertToKB(storageInfo.usage),
storageEstimateCaches: utils_1.convertToKB(estimateUsageDetails.caches),
storageEstimateIndexedDB: utils_1.convertToKB(estimateUsageDetails.indexedDB),
storageEstimatSW: utils_1.convertToKB(estimateUsageDetails.serviceWorkerRegistrations),
quota: utils_1.convertToKB(storageInfo.quota),
usage: utils_1.convertToKB(storageInfo.usage),
caches: utils_1.convertToKB(estimateUsageDetails.caches),
indexedDB: utils_1.convertToKB(estimateUsageDetails.indexedDB),
serviceWorker: utils_1.convertToKB(estimateUsageDetails.serviceWorkerRegistrations),
});
};
//# sourceMappingURL=storageEstimate.js.map

@@ -1,2 +0,2 @@

var t={resourceTiming:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},i=window.console,n=document,e=window,r=window.navigator,a=window.performance,o=function(){return a&&!!a.getEntriesByType&&!!a.now&&!!a.mark},s=function(){return r?{deviceMemory:r.deviceMemory?r.deviceMemory:0,hardwareConcurrency:r.hardwareConcurrency?r.hardwareConcurrency:0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported"}:{}},u="4g",f=!1,c=function(){return!!(r.hardwareConcurrency&&r.hardwareConcurrency<=4)||!!(r.deviceMemory&&r.deviceMemory<=4)},m=function(t,i){return!!c()||(!!["slow-2g","2g","3g"].includes(t)||!!i)},h={t:!1},l=function(t){n.hidden&&(t(),h.t=n.hidden)},d=function(i){h.t&&i.i.indexOf("Hidden")<0||!t.analyticsTracker||t.analyticsTracker({metricName:i.i,data:i.data,eventProperties:i.o?i.o:{},navigatorInformation:i.s})},v=function(t){return"number"!=typeof t?null:parseFloat((t/Math.pow(1024,2)).toFixed(2))},g=function(t){"requestIdleCallback"in e?e.requestIdleCallback(t,{timeout:3e3}):t()},p=function(n){h.t&&n.i.indexOf("Hidden")<0||!t.logging||i.log("%c "+t.logPrefix+" "+n.i+" ","color:#ff6d00;font-size:11px;",n.data,n.s)},T=function(t,i){Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var n=s();n.isLowEndDevice=c(),n.isLowEndExperience=m(u,f),g((function(){p({i:t,data:i,s:n}),d({i:t,data:i,s:n})}))},y=function(i,n,e){void 0===e&&(e="ms");var r=parseFloat(i.toFixed(2));if(!(r>t.maxMeasureTime||r<=0)){var a=s();a.isLowEndDevice=c(),a.isLowEndExperience=m(u,f),g((function(){p({i:n,data:r+" "+e,s:a}),d({i:n,data:r,s:a})}))}},k=function(n){t.logging&&i.warn(t.logPrefix,n)},w=function(t,i){try{var n=new PerformanceObserver((function(t){var n=t.getEntries();i(n)}));return n.observe({type:t,buffered:!0}),n}catch(t){k(t)}return null},_=function(t){var i={};"usageDetails"in t&&(i=t.usageDetails),T("storageEstimate",{storageEstimateQuota:v(t.quota),storageEstimateUsage:v(t.usage),storageEstimateCaches:v(i.caches),storageEstimateIndexedDB:v(i.indexedDB),storageEstimatSW:v(i.serviceWorkerRegistrations)})},E=0,I=0,N=0,b=function(){function i(i){void 0===i&&(i={}),this.u="© 2020 Leonardo Zizzamia",this.version="5.0.0-rc.9",this.m="Recording already",this.h={},this.l={},this.v={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.g=0,t.resourceTiming=!!i.resourceTiming,t.logPrefix=i.logPrefix||t.logPrefix,t.logging=!!i.logging,t.maxMeasureTime=i.maxMeasureTime||t.maxMeasureTime,o()&&("PerformanceObserver"in e&&this.p(),function(t){void 0!==n.hidden&&n.addEventListener("visibilitychange",l.bind(this,t))}(this.T),T("navigationTiming",function(){if(!o())return{};var t=a.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,n=t.responseEnd;return{fetchTime:n-t.fetchStart,workerTime:t.workerStart>0?n-t.workerStart:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}}()),T("networkInformation",function(){if("connection"in r){var t=r.connection;return"object"!=typeof t?{}:(u=t.effectiveType,f=!!t.saveData,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(_))}return i.prototype.start=function(t){o()&&(this.h[t]?k(this.m+" started."):(this.h[t]=!0,a.mark("mark_"+t+"_start"),h.t=!1))},i.prototype.end=function(t,i){if(void 0===i&&(i={}),o())if(this.h[t]){a.mark("mark_"+t+"_end");var n=this.k(t),e=parseFloat(n.toFixed(2));delete this.h[t],g((function(){var n=s();n.isLowEndDevice=c(),n.isLowEndExperience=m(u,f);var r={i:t,data:e,o:i,s:n};p(r),d(r)}))}else k(this.m+" stopped.")},i.prototype.endPaint=function(t,i){var n=this;setTimeout((function(){n.end(t,i)}))},i.prototype.clear=function(t){delete this.h[t],a.clearMarks&&(a.clearMarks("mark_"+t+"_start"),a.clearMarks("mark_"+t+"_end"))},i.prototype._=function(t){this.I({N:t,i:"firstInputDelay",P:"duration"}),this.C(N,I),this.L(),this.S()},i.prototype.L=function(){this.B&&(clearTimeout(this.B),this.B=void 0,T("dataConsumption",this.v))},i.prototype.C=function(t,i){this.l.D&&t&&y(t,"largestContentfulPaint"),this.l.F&&i>0&&(this.l.F.takeRecords(),y(i,"cumulativeLayoutShift","")),this.l.H&&this.g&&y(this.g,"totalBlockingTime")},i.prototype.T=function(){this.l.D&&N&&(y(N,"largestContentfulPaintUntilHidden"),this.l.D.disconnect()),this.l.F&&I>0&&(this.l.F.takeRecords(),y(I,"cumulativeLayoutShiftUntilHidden",""),this.l.F.disconnect())},i.prototype.S=function(){var t=this;setTimeout((function(){t.l.H&&t.g&&y(t.g,"totalBlockingTime5S")}),5e3),setTimeout((function(){t.l.H&&(t.g&&y(t.g,"totalBlockingTime10S"),t.l.H.disconnect())}),1e4)},i.prototype.j=function(){this.l.M=w("first-input",this._.bind(this))},i.prototype.O=function(){var t=this;this.l.U=w("paint",(function(i){t.I({N:i,W:"first-paint",i:"firstPaint",P:"startTime"}),t.I({N:i,W:"first-contentful-paint",i:"firstContentfulPaint",P:"startTime"})}))},i.prototype.q=function(){this.l.D=w("largest-contentful-paint",(function(t){var i=t.pop();i&&(N=i.renderTime||i.loadTime)}))},i.prototype.R=function(){this.l.F=w("layout-shift",(function(t){var i=t.pop();i&&!i.Z&&i.value&&(I+=i.value)}))},i.prototype.p=function(){this.O(),this.j(),this.q(),t.resourceTiming&&this.A(),this.R()},i.prototype.A=function(){var t=this;w("resource",(function(i){t.G({N:i})})),this.B=setTimeout((function(){t.L()}),15e3)},i.prototype.J=function(){var t=this;this.l.H=w("longtask",(function(i){t.K({N:i})}))},i.prototype.V=function(t){var i=a.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},i.prototype.k=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return a.measure(t,i,n),this.V(t)},i.prototype.I=function(t){var i=this;t.N.forEach((function(n){(!t.W||t.W&&n.name===t.W)&&y(n[t.P],t.i),i.l.U&&"first-contentful-paint"===n.name&&(E=n.startTime,i.J(),i.l.U.disconnect())})),this.l.M&&"firstInputDelay"===t.i&&this.l.M.disconnect()},i.prototype.G=function(i){var n=this;i.N.forEach((function(i){if(t.resourceTiming&&T("resourceTiming",i),i.decodedBodySize&&i.initiatorType){var e=i.decodedBodySize/1e3;n.v[i.initiatorType]+=e,n.v.total+=e}}))},i.prototype.K=function(t){var i=this;t.N.forEach((function(t){if(!("self"!==t.name||t.startTime<E)){var n=t.duration-50;n&&(i.g+=n)}}))},i}();export default b;
var t={resourceTiming:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},n=window.console,e=document,i=window,r=window.navigator,a=window.performance,o=function(){return a&&!!a.getEntriesByType&&!!a.now&&!!a.mark},u=function(){return r?{deviceMemory:r.deviceMemory?r.deviceMemory:0,hardwareConcurrency:r.hardwareConcurrency?r.hardwareConcurrency:0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported"}:{}},f="4g",c=!1,s=function(){return!!(r.hardwareConcurrency&&r.hardwareConcurrency<=4)||!!(r.deviceMemory&&r.deviceMemory<=4)},l=function(t,n){return!!s()||(!!["slow-2g","2g","3g"].includes(t)||!!n)},m={t:!1},d=function(t){e.hidden&&(t(),m.t=e.hidden)},v=function(n){m.t&&n.i.indexOf("Hidden")<0||!t.analyticsTracker||t.analyticsTracker({metricName:n.i,data:n.data,eventProperties:n.o?n.o:{},navigatorInformation:n.u})},g=function(t){return"number"!=typeof t?null:parseFloat((t/Math.pow(1024,2)).toFixed(2))},p=function(t){"requestIdleCallback"in i?i.requestIdleCallback(t,{timeout:3e3}):t()},h=function(e){m.t&&e.i.indexOf("Hidden")<0||!t.logging||n.log("%c "+t.logPrefix+" "+e.i+" ","color:#ff6d00;font-size:11px;",e.data,e.u)},k=function(t,n){Object.keys(n).forEach((function(t){"number"==typeof n[t]&&(n[t]=parseFloat(n[t].toFixed(2)))}));var e=u();e.isLowEndDevice=s(),e.isLowEndExperience=l(f,c),p((function(){h({i:t,data:n,u:e}),v({i:t,data:n,u:e})}))},T=function(n,e,i){void 0===i&&(i="ms");var r=parseFloat(n.toFixed(2));if(!(r>t.maxMeasureTime||r<=0)){var a=u();a.isLowEndDevice=s(),a.isLowEndExperience=l(f,c),p((function(){h({i:e,data:r+" "+i,u:a}),v({i:e,data:r,u:a})}))}},y=function(e){t.logging&&n.warn(t.logPrefix,e)},w=function(t){var n="mark_"+t+"_start",e="mark_"+t+"_end";return a.measure(t,n,e),function(t){var n=a.getEntriesByName(t),e=n[n.length-1];return e&&"measure"===e.entryType?e.duration:-1}(t)},_={value:0},b={value:0},P={value:0},I={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},x={value:0},C=function(t){var n=t.pop();n&&!n.s&&n.value&&(_.value+=n.value)},N={},S=function(t){var n=t.pop();n&&T(n.duration,"firstInputDelay"),N.l.disconnect(),N.m&&T(P.value,"largestContentfulPaint"),N.v&&(N.v.takeRecords(),T(_.value,"cumulativeLayoutShift","")),N.g&&T(x.value,"totalBlockingTime"),setTimeout((function(){N.g&&T(x.value,"totalBlockingTime5S")}),5e3),setTimeout((function(){N.g&&(T(x.value,"totalBlockingTime10S"),N.g.disconnect()),k("dataConsumption",I.value)}),1e4)},B=function(t,n){try{var e=new PerformanceObserver((function(t){var e=t.getEntries();n(e)}));return e.observe({type:t,buffered:!0}),e}catch(t){y(t)}return null},F=function(t){t.forEach((function(t){if(!("self"!==t.name||t.startTime<b.value)){var n=t.duration-50;n&&(x.value+=n)}}))},H=function(t){t.forEach((function(t){"first-paint"===t.name?T(t.startTime,"firstPaint"):"first-contentful-paint"===t.name&&T(t.startTime,"firstContentfulPaint"),"first-contentful-paint"===t.name&&(b.value=t.startTime,N.g=B("longtask",F),N.p.disconnect())}))},z=function(t){var n=t.pop();n&&(P.value=n.renderTime||n.loadTime)},D=function(n){n.forEach((function(n){if(t.resourceTiming&&k("resourceTiming",n),n.decodedBodySize&&n.initiatorType){var e=n.decodedBodySize/1e3;I.value[n.initiatorType]+=e,I.value.total+=e}}))},L=function(){N.m&&(T(P.value,"largestContentfulPaintUntilHidden"),N.m.disconnect()),N.v&&(N.v.takeRecords(),T(_.value,"cumulativeLayoutShiftUntilHidden",""),N.v.disconnect())},j=function(t){var n={};"usageDetails"in t&&(n=t.usageDetails),k("storageEstimate",{quota:g(t.quota),usage:g(t.usage),caches:g(n.caches),indexedDB:g(n.indexedDB),serviceWorker:g(n.serviceWorkerRegistrations)})},q=function(){function n(n){void 0===n&&(n={}),this.h="© 2020 Leonardo Zizzamia",this.version="5.0.0-rc.10",this.k={},t.resourceTiming=!!n.resourceTiming,t.logPrefix=n.logPrefix||t.logPrefix,t.logging=!!n.logging,t.maxMeasureTime=n.maxMeasureTime||t.maxMeasureTime,o()&&("PerformanceObserver"in i&&(N.p=B("paint",H),N.l=B("first-input",S),N.m=B("largest-contentful-paint",z),t.resourceTiming&&B("resource",D),N.v=B("layout-shift",C)),function(t){void 0!==e.hidden&&e.addEventListener("visibilitychange",d.bind(this,t))}(L),k("navigationTiming",function(){if(!o())return{};var t=a.getEntriesByType("navigation")[0];if(!t)return{};var n=t.responseStart,e=t.responseEnd;return{fetchTime:e-t.fetchStart,workerTime:t.workerStart>0?e-t.workerStart:0,totalTime:e-t.requestStart,downloadTime:e-n,timeToFirstByte:n-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}}()),k("networkInformation",function(){if("connection"in r){var t=r.connection;return"object"!=typeof t?{}:(f=t.effectiveType,c=!!t.saveData,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(j))}return n.prototype.start=function(t){o()&&(this.k[t]?y("Recording already started."):(this.k[t]=!0,a.mark("mark_"+t+"_start"),m.t=!1))},n.prototype.end=function(t,n){if(void 0===n&&(n={}),o())if(this.k[t]){a.mark("mark_"+t+"_end");var e=w(t),i=parseFloat(e.toFixed(2));delete this.k[t],p((function(){var e=u();e.isLowEndDevice=s(),e.isLowEndExperience=l(f,c);var r={i:t,data:i,o:n,u:e};h(r),v(r)}))}else y("Recording already stopped.")},n.prototype.endPaint=function(t,n){var e=this;setTimeout((function(){e.end(t,n)}))},n.prototype.clear=function(t){delete this.k[t],a.clearMarks&&(a.clearMarks("mark_"+t+"_start"),a.clearMarks("mark_"+t+"_end"))},n}();export default q;
//# sourceMappingURL=perfume.esm.min.js.map

@@ -1,2 +0,2 @@

var Perfume=function(){"use strict";var t={resourceTiming:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},i=window.console,n=document,e=window,r=window.navigator,a=window.performance,o=function(){return a&&!!a.getEntriesByType&&!!a.now&&!!a.mark},s=function(){return r?{deviceMemory:r.deviceMemory?r.deviceMemory:0,hardwareConcurrency:r.hardwareConcurrency?r.hardwareConcurrency:0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported"}:{}},u="4g",f=!1,c=function(){return!!(r.hardwareConcurrency&&r.hardwareConcurrency<=4)||!!(r.deviceMemory&&r.deviceMemory<=4)},m=function(t,i){return!!c()||(!!["slow-2g","2g","3g"].includes(t)||!!i)},h={t:!1},l=function(t){n.hidden&&(t(),h.t=n.hidden)},v=function(i){h.t&&i.i.indexOf("Hidden")<0||!t.analyticsTracker||t.analyticsTracker({metricName:i.i,data:i.data,eventProperties:i.o?i.o:{},navigatorInformation:i.s})},d=function(t){return"number"!=typeof t?null:parseFloat((t/Math.pow(1024,2)).toFixed(2))},g=function(t){"requestIdleCallback"in e?e.requestIdleCallback(t,{timeout:3e3}):t()},p=function(n){h.t&&n.i.indexOf("Hidden")<0||!t.logging||i.log("%c "+t.logPrefix+" "+n.i+" ","color:#ff6d00;font-size:11px;",n.data,n.s)},T=function(t,i){Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var n=s();n.isLowEndDevice=c(),n.isLowEndExperience=m(u,f),g((function(){p({i:t,data:i,s:n}),v({i:t,data:i,s:n})}))},y=function(i,n,e){void 0===e&&(e="ms");var r=parseFloat(i.toFixed(2));if(!(r>t.maxMeasureTime||r<=0)){var a=s();a.isLowEndDevice=c(),a.isLowEndExperience=m(u,f),g((function(){p({i:n,data:r+" "+e,s:a}),v({i:n,data:r,s:a})}))}},k=function(n){t.logging&&i.warn(t.logPrefix,n)},w=function(t,i){try{var n=new PerformanceObserver((function(t){var n=t.getEntries();i(n)}));return n.observe({type:t,buffered:!0}),n}catch(t){k(t)}return null},_=function(t){var i={};"usageDetails"in t&&(i=t.usageDetails),T("storageEstimate",{storageEstimateQuota:d(t.quota),storageEstimateUsage:d(t.usage),storageEstimateCaches:d(i.caches),storageEstimateIndexedDB:d(i.indexedDB),storageEstimatSW:d(i.serviceWorkerRegistrations)})},E=0,I=0,N=0;return function(){function i(i){void 0===i&&(i={}),this.u="© 2020 Leonardo Zizzamia",this.version="5.0.0-rc.9",this.m="Recording already",this.h={},this.l={},this.v={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.g=0,t.resourceTiming=!!i.resourceTiming,t.logPrefix=i.logPrefix||t.logPrefix,t.logging=!!i.logging,t.maxMeasureTime=i.maxMeasureTime||t.maxMeasureTime,o()&&("PerformanceObserver"in e&&this.p(),function(t){void 0!==n.hidden&&n.addEventListener("visibilitychange",l.bind(this,t))}(this.T),T("navigationTiming",function(){if(!o())return{};var t=a.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,n=t.responseEnd;return{fetchTime:n-t.fetchStart,workerTime:t.workerStart>0?n-t.workerStart:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}}()),T("networkInformation",function(){if("connection"in r){var t=r.connection;return"object"!=typeof t?{}:(u=t.effectiveType,f=!!t.saveData,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(_))}return i.prototype.start=function(t){o()&&(this.h[t]?k(this.m+" started."):(this.h[t]=!0,a.mark("mark_"+t+"_start"),h.t=!1))},i.prototype.end=function(t,i){if(void 0===i&&(i={}),o())if(this.h[t]){a.mark("mark_"+t+"_end");var n=this.k(t),e=parseFloat(n.toFixed(2));delete this.h[t],g((function(){var n=s();n.isLowEndDevice=c(),n.isLowEndExperience=m(u,f);var r={i:t,data:e,o:i,s:n};p(r),v(r)}))}else k(this.m+" stopped.")},i.prototype.endPaint=function(t,i){var n=this;setTimeout((function(){n.end(t,i)}))},i.prototype.clear=function(t){delete this.h[t],a.clearMarks&&(a.clearMarks("mark_"+t+"_start"),a.clearMarks("mark_"+t+"_end"))},i.prototype._=function(t){this.I({N:t,i:"firstInputDelay",P:"duration"}),this.C(N,I),this.L(),this.S()},i.prototype.L=function(){this.B&&(clearTimeout(this.B),this.B=void 0,T("dataConsumption",this.v))},i.prototype.C=function(t,i){this.l.D&&t&&y(t,"largestContentfulPaint"),this.l.F&&i>0&&(this.l.F.takeRecords(),y(i,"cumulativeLayoutShift","")),this.l.H&&this.g&&y(this.g,"totalBlockingTime")},i.prototype.T=function(){this.l.D&&N&&(y(N,"largestContentfulPaintUntilHidden"),this.l.D.disconnect()),this.l.F&&I>0&&(this.l.F.takeRecords(),y(I,"cumulativeLayoutShiftUntilHidden",""),this.l.F.disconnect())},i.prototype.S=function(){var t=this;setTimeout((function(){t.l.H&&t.g&&y(t.g,"totalBlockingTime5S")}),5e3),setTimeout((function(){t.l.H&&(t.g&&y(t.g,"totalBlockingTime10S"),t.l.H.disconnect())}),1e4)},i.prototype.j=function(){this.l.M=w("first-input",this._.bind(this))},i.prototype.O=function(){var t=this;this.l.U=w("paint",(function(i){t.I({N:i,W:"first-paint",i:"firstPaint",P:"startTime"}),t.I({N:i,W:"first-contentful-paint",i:"firstContentfulPaint",P:"startTime"})}))},i.prototype.q=function(){this.l.D=w("largest-contentful-paint",(function(t){var i=t.pop();i&&(N=i.renderTime||i.loadTime)}))},i.prototype.R=function(){this.l.F=w("layout-shift",(function(t){var i=t.pop();i&&!i.Z&&i.value&&(I+=i.value)}))},i.prototype.p=function(){this.O(),this.j(),this.q(),t.resourceTiming&&this.A(),this.R()},i.prototype.A=function(){var t=this;w("resource",(function(i){t.G({N:i})})),this.B=setTimeout((function(){t.L()}),15e3)},i.prototype.J=function(){var t=this;this.l.H=w("longtask",(function(i){t.K({N:i})}))},i.prototype.V=function(t){var i=a.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},i.prototype.k=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return a.measure(t,i,n),this.V(t)},i.prototype.I=function(t){var i=this;t.N.forEach((function(n){(!t.W||t.W&&n.name===t.W)&&y(n[t.P],t.i),i.l.U&&"first-contentful-paint"===n.name&&(E=n.startTime,i.J(),i.l.U.disconnect())})),this.l.M&&"firstInputDelay"===t.i&&this.l.M.disconnect()},i.prototype.G=function(i){var n=this;i.N.forEach((function(i){if(t.resourceTiming&&T("resourceTiming",i),i.decodedBodySize&&i.initiatorType){var e=i.decodedBodySize/1e3;n.v[i.initiatorType]+=e,n.v.total+=e}}))},i.prototype.K=function(t){var i=this;t.N.forEach((function(t){if(!("self"!==t.name||t.startTime<E)){var n=t.duration-50;n&&(i.g+=n)}}))},i}()}();
var Perfume=function(){"use strict";var t={resourceTiming:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},n=window.console,e=document,i=window,r=window.navigator,a=window.performance,o=function(){return a&&!!a.getEntriesByType&&!!a.now&&!!a.mark},u=function(){return r?{deviceMemory:r.deviceMemory?r.deviceMemory:0,hardwareConcurrency:r.hardwareConcurrency?r.hardwareConcurrency:0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported"}:{}},f="4g",c=!1,s=function(){return!!(r.hardwareConcurrency&&r.hardwareConcurrency<=4)||!!(r.deviceMemory&&r.deviceMemory<=4)},l=function(t,n){return!!s()||(!!["slow-2g","2g","3g"].includes(t)||!!n)},m={t:!1},d=function(t){e.hidden&&(t(),m.t=e.hidden)},v=function(n){m.t&&n.i.indexOf("Hidden")<0||!t.analyticsTracker||t.analyticsTracker({metricName:n.i,data:n.data,eventProperties:n.o?n.o:{},navigatorInformation:n.u})},g=function(t){return"number"!=typeof t?null:parseFloat((t/Math.pow(1024,2)).toFixed(2))},p=function(t){"requestIdleCallback"in i?i.requestIdleCallback(t,{timeout:3e3}):t()},h=function(e){m.t&&e.i.indexOf("Hidden")<0||!t.logging||n.log("%c "+t.logPrefix+" "+e.i+" ","color:#ff6d00;font-size:11px;",e.data,e.u)},k=function(t,n){Object.keys(n).forEach((function(t){"number"==typeof n[t]&&(n[t]=parseFloat(n[t].toFixed(2)))}));var e=u();e.isLowEndDevice=s(),e.isLowEndExperience=l(f,c),p((function(){h({i:t,data:n,u:e}),v({i:t,data:n,u:e})}))},T=function(n,e,i){void 0===i&&(i="ms");var r=parseFloat(n.toFixed(2));if(!(r>t.maxMeasureTime||r<=0)){var a=u();a.isLowEndDevice=s(),a.isLowEndExperience=l(f,c),p((function(){h({i:e,data:r+" "+i,u:a}),v({i:e,data:r,u:a})}))}},y=function(e){t.logging&&n.warn(t.logPrefix,e)},w=function(t){var n="mark_"+t+"_start",e="mark_"+t+"_end";return a.measure(t,n,e),function(t){var n=a.getEntriesByName(t),e=n[n.length-1];return e&&"measure"===e.entryType?e.duration:-1}(t)},_={value:0},P={value:0},b={value:0},I={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},C={value:0},N=function(t){var n=t.pop();n&&!n.s&&n.value&&(_.value+=n.value)},S={},x=function(t){var n=t.pop();n&&T(n.duration,"firstInputDelay"),S.l.disconnect(),S.m&&T(b.value,"largestContentfulPaint"),S.v&&(S.v.takeRecords(),T(_.value,"cumulativeLayoutShift","")),S.g&&T(C.value,"totalBlockingTime"),setTimeout((function(){S.g&&T(C.value,"totalBlockingTime5S")}),5e3),setTimeout((function(){S.g&&(T(C.value,"totalBlockingTime10S"),S.g.disconnect()),k("dataConsumption",I.value)}),1e4)},B=function(t,n){try{var e=new PerformanceObserver((function(t){var e=t.getEntries();n(e)}));return e.observe({type:t,buffered:!0}),e}catch(t){y(t)}return null},F=function(t){t.forEach((function(t){if(!("self"!==t.name||t.startTime<P.value)){var n=t.duration-50;n&&(C.value+=n)}}))},H=function(t){t.forEach((function(t){"first-paint"===t.name?T(t.startTime,"firstPaint"):"first-contentful-paint"===t.name&&T(t.startTime,"firstContentfulPaint"),"first-contentful-paint"===t.name&&(P.value=t.startTime,S.g=B("longtask",F),S.p.disconnect())}))},z=function(t){var n=t.pop();n&&(b.value=n.renderTime||n.loadTime)},D=function(n){n.forEach((function(n){if(t.resourceTiming&&k("resourceTiming",n),n.decodedBodySize&&n.initiatorType){var e=n.decodedBodySize/1e3;I.value[n.initiatorType]+=e,I.value.total+=e}}))},L=function(){S.m&&(T(b.value,"largestContentfulPaintUntilHidden"),S.m.disconnect()),S.v&&(S.v.takeRecords(),T(_.value,"cumulativeLayoutShiftUntilHidden",""),S.v.disconnect())},j=function(t){var n={};"usageDetails"in t&&(n=t.usageDetails),k("storageEstimate",{quota:g(t.quota),usage:g(t.usage),caches:g(n.caches),indexedDB:g(n.indexedDB),serviceWorker:g(n.serviceWorkerRegistrations)})};return function(){function n(n){void 0===n&&(n={}),this.h="© 2020 Leonardo Zizzamia",this.version="5.0.0-rc.10",this.k={},t.resourceTiming=!!n.resourceTiming,t.logPrefix=n.logPrefix||t.logPrefix,t.logging=!!n.logging,t.maxMeasureTime=n.maxMeasureTime||t.maxMeasureTime,o()&&("PerformanceObserver"in i&&(S.p=B("paint",H),S.l=B("first-input",x),S.m=B("largest-contentful-paint",z),t.resourceTiming&&B("resource",D),S.v=B("layout-shift",N)),function(t){void 0!==e.hidden&&e.addEventListener("visibilitychange",d.bind(this,t))}(L),k("navigationTiming",function(){if(!o())return{};var t=a.getEntriesByType("navigation")[0];if(!t)return{};var n=t.responseStart,e=t.responseEnd;return{fetchTime:e-t.fetchStart,workerTime:t.workerStart>0?e-t.workerStart:0,totalTime:e-t.requestStart,downloadTime:e-n,timeToFirstByte:n-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}}()),k("networkInformation",function(){if("connection"in r){var t=r.connection;return"object"!=typeof t?{}:(f=t.effectiveType,c=!!t.saveData,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(j))}return n.prototype.start=function(t){o()&&(this.k[t]?y("Recording already started."):(this.k[t]=!0,a.mark("mark_"+t+"_start"),m.t=!1))},n.prototype.end=function(t,n){if(void 0===n&&(n={}),o())if(this.k[t]){a.mark("mark_"+t+"_end");var e=w(t),i=parseFloat(e.toFixed(2));delete this.k[t],p((function(){var e=u();e.isLowEndDevice=s(),e.isLowEndExperience=l(f,c);var r={i:t,data:i,o:n,u:e};h(r),v(r)}))}else y("Recording already stopped.")},n.prototype.endPaint=function(t,n){var e=this;setTimeout((function(){e.end(t,n)}))},n.prototype.clear=function(t){delete this.k[t],a.clearMarks&&(a.clearMarks("mark_"+t+"_start"),a.clearMarks("mark_"+t+"_end"))},n}()}();
//# sourceMappingURL=perfume.iife.min.js.map

@@ -1,2 +0,2 @@

"use strict";var config={resourceTiming:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},C=window.console,D=document,W=window,WN=window.navigator,WP=window.performance,isPerformanceSupported=function(){return WP&&!!WP.getEntriesByType&&!!WP.now&&!!WP.mark},isPerformanceObserverSupported=function(){return"PerformanceObserver"in W},getNavigationTiming=function(){if(!isPerformanceSupported())return{};var t=WP.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,e=t.responseEnd;return{fetchTime:e-t.fetchStart,workerTime:t.workerStart>0?e-t.workerStart:0,totalTime:e-t.requestStart,downloadTime:e-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}},getNavigatorInfo=function(){return WN?{deviceMemory:WN.deviceMemory?WN.deviceMemory:0,hardwareConcurrency:WN.hardwareConcurrency?WN.hardwareConcurrency:0,serviceWorkerStatus:"serviceWorker"in WN?WN.serviceWorker.controller?"controlled":"supported":"unsupported"}:{}},et="4g",sd=!1,getNetworkInformation=function(){if("connection"in WN){var t=WN.connection;return"object"!=typeof t?{}:(et=t.effectiveType,sd=!!t.saveData,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}},getIsLowEndDevice=function(){return!!(WN.hardwareConcurrency&&WN.hardwareConcurrency<=4)||!!(WN.deviceMemory&&WN.deviceMemory<=4)},getIsLowEndExperience=function(t,i){return!!getIsLowEndDevice()||(!!["slow-2g","2g","3g"].includes(t)||!!i)},visibility={t:!1},onVisibilityChange=function(t){void 0!==D.hidden&&D.addEventListener("visibilitychange",didVisibilityChange.bind(this,t))},didVisibilityChange=function(t){D.hidden&&(t(),visibility.t=D.hidden)},reportPerf=function(t){visibility.t&&t.i.indexOf("Hidden")<0||!config.analyticsTracker||config.analyticsTracker({metricName:t.i,data:t.data,eventProperties:t.o?t.o:{},navigatorInformation:t.s})},convertToKB=function(t){return"number"!=typeof t?null:parseFloat((t/Math.pow(1024,2)).toFixed(2))},pushTask=function(t){"requestIdleCallback"in W?W.requestIdleCallback(t,{timeout:3e3}):t()},log=function(t){visibility.t&&t.i.indexOf("Hidden")<0||!config.logging||C.log("%c "+config.logPrefix+" "+t.i+" ","color:#ff6d00;font-size:11px;",t.data,t.s)},logData=function(t,i){Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var e=getNavigatorInfo();e.isLowEndDevice=getIsLowEndDevice(),e.isLowEndExperience=getIsLowEndExperience(et,sd),pushTask((function(){log({i:t,data:i,s:e}),reportPerf({i:t,data:i,s:e})}))},logMetric=function(t,i,e){void 0===e&&(e="ms");var n=parseFloat(t.toFixed(2));if(!(n>config.maxMeasureTime||n<=0)){var o=getNavigatorInfo();o.isLowEndDevice=getIsLowEndDevice(),o.isLowEndExperience=getIsLowEndExperience(et,sd),pushTask((function(){log({i:i,data:n+" "+e,s:o}),reportPerf({i:i,data:n,s:o})}))}},logWarn=function(t){config.logging&&C.warn(config.logPrefix,t)},po=function(t,i){try{var e=new PerformanceObserver((function(t){var e=t.getEntries();i(e)}));return e.observe({type:t,buffered:!0}),e}catch(t){logWarn(t)}return null},initStorageEstimate=function(){WN&&WN.storage&&WN.storage.estimate().then(reportStorageEstimate)},reportStorageEstimate=function(t){var i={};"usageDetails"in t&&(i=t.usageDetails),logData("storageEstimate",{storageEstimateQuota:convertToKB(t.quota),storageEstimateUsage:convertToKB(t.usage),storageEstimateCaches:convertToKB(i.caches),storageEstimateIndexedDB:convertToKB(i.indexedDB),storageEstimatSW:convertToKB(i.serviceWorkerRegistrations)})},fcp=0,clsScore=0,lcp=0,Perfume=function(){function t(t){void 0===t&&(t={}),this.u="© 2020 Leonardo Zizzamia",this.version="5.0.0-rc.9",this.g="Recording already",this.l={},this.m={},this.h={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.p=0,config.resourceTiming=!!t.resourceTiming,config.logPrefix=t.logPrefix||config.logPrefix,config.logging=!!t.logging,config.maxMeasureTime=t.maxMeasureTime||config.maxMeasureTime,isPerformanceSupported()&&(isPerformanceObserverSupported()&&this.v(),onVisibilityChange(this.W),logData("navigationTiming",getNavigationTiming()),logData("networkInformation",getNetworkInformation()),initStorageEstimate())}return t.prototype.start=function(t){isPerformanceSupported()&&(this.l[t]?logWarn(this.g+" started."):(this.l[t]=!0,WP.mark("mark_"+t+"_start"),visibility.t=!1))},t.prototype.end=function(t,i){if(void 0===i&&(i={}),isPerformanceSupported())if(this.l[t]){WP.mark("mark_"+t+"_end");var e=this.N(t),n=parseFloat(e.toFixed(2));delete this.l[t],pushTask((function(){var e=getNavigatorInfo();e.isLowEndDevice=getIsLowEndDevice(),e.isLowEndExperience=getIsLowEndExperience(et,sd);var o={i:t,data:n,o:i,s:e};log(o),reportPerf(o)}))}else logWarn(this.g+" stopped.")},t.prototype.endPaint=function(t,i){var e=this;setTimeout((function(){e.end(t,i)}))},t.prototype.clear=function(t){delete this.l[t],WP.clearMarks&&(WP.clearMarks("mark_"+t+"_start"),WP.clearMarks("mark_"+t+"_end"))},t.prototype.P=function(t){this.T({I:t,i:"firstInputDelay",k:"duration"}),this.S(lcp,clsScore),this.D(),this.L()},t.prototype.D=function(){this.C&&(clearTimeout(this.C),this.C=void 0,logData("dataConsumption",this.h))},t.prototype.S=function(t,i){this.m.M&&t&&logMetric(t,"largestContentfulPaint"),this.m._&&i>0&&(this.m._.takeRecords(),logMetric(i,"cumulativeLayoutShift","")),this.m.B&&this.p&&logMetric(this.p,"totalBlockingTime")},t.prototype.W=function(){this.m.M&&lcp&&(logMetric(lcp,"largestContentfulPaintUntilHidden"),this.m.M.disconnect()),this.m._&&clsScore>0&&(this.m._.takeRecords(),logMetric(clsScore,"cumulativeLayoutShiftUntilHidden",""),this.m._.disconnect())},t.prototype.L=function(){var t=this;setTimeout((function(){t.m.B&&t.p&&logMetric(t.p,"totalBlockingTime5S")}),5e3),setTimeout((function(){t.m.B&&(t.p&&logMetric(t.p,"totalBlockingTime10S"),t.m.B.disconnect())}),1e4)},t.prototype.K=function(){this.m.F=po("first-input",this.P.bind(this))},t.prototype.H=function(){var t=this;this.m.O=po("paint",(function(i){t.T({I:i,V:"first-paint",i:"firstPaint",k:"startTime"}),t.T({I:i,V:"first-contentful-paint",i:"firstContentfulPaint",k:"startTime"})}))},t.prototype.j=function(){this.m.M=po("largest-contentful-paint",(function(t){var i=t.pop();i&&(lcp=i.renderTime||i.loadTime)}))},t.prototype.U=function(){this.m._=po("layout-shift",(function(t){var i=t.pop();i&&!i.q&&i.value&&(clsScore+=i.value)}))},t.prototype.v=function(){this.H(),this.K(),this.j(),config.resourceTiming&&this.R(),this.U()},t.prototype.R=function(){var t=this;po("resource",(function(i){t.Z({I:i})})),this.C=setTimeout((function(){t.D()}),15e3)},t.prototype.A=function(){var t=this;this.m.B=po("longtask",(function(i){t.G({I:i})}))},t.prototype.J=function(t){var i=WP.getEntriesByName(t),e=i[i.length-1];return e&&"measure"===e.entryType?e.duration:-1},t.prototype.N=function(t){var i="mark_"+t+"_start",e="mark_"+t+"_end";return WP.measure(t,i,e),this.J(t)},t.prototype.T=function(t){var i=this;t.I.forEach((function(e){(!t.V||t.V&&e.name===t.V)&&logMetric(e[t.k],t.i),i.m.O&&"first-contentful-paint"===e.name&&(fcp=e.startTime,i.A(),i.m.O.disconnect())})),this.m.F&&"firstInputDelay"===t.i&&this.m.F.disconnect()},t.prototype.Z=function(t){var i=this;t.I.forEach((function(t){if(config.resourceTiming&&logData("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;i.h[t.initiatorType]+=e,i.h.total+=e}}))},t.prototype.G=function(t){var i=this;t.I.forEach((function(t){if(!("self"!==t.name||t.startTime<fcp)){var e=t.duration-50;e&&(i.p+=e)}}))},t}();module.exports=Perfume;
"use strict";var config={resourceTiming:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},C=window.console,D=document,W=window,WN=window.navigator,WP=window.performance,isPerformanceSupported=function(){return WP&&!!WP.getEntriesByType&&!!WP.now&&!!WP.mark},isPerformanceObserverSupported=function(){return"PerformanceObserver"in W},getNavigationTiming=function(){if(!isPerformanceSupported())return{};var e=WP.getEntriesByType("navigation")[0];if(!e)return{};var t=e.responseStart,r=e.responseEnd;return{fetchTime:r-e.fetchStart,workerTime:e.workerStart>0?r-e.workerStart:0,totalTime:r-e.requestStart,downloadTime:r-t,timeToFirstByte:t-e.requestStart,headerSize:e.transferSize-e.encodedBodySize||0,dnsLookupTime:e.domainLookupEnd-e.domainLookupStart}},getNavigatorInfo=function(){return WN?{deviceMemory:WN.deviceMemory?WN.deviceMemory:0,hardwareConcurrency:WN.hardwareConcurrency?WN.hardwareConcurrency:0,serviceWorkerStatus:"serviceWorker"in WN?WN.serviceWorker.controller?"controlled":"supported":"unsupported"}:{}},et="4g",sd=!1,getNetworkInformation=function(){if("connection"in WN){var e=WN.connection;return"object"!=typeof e?{}:(et=e.effectiveType,sd=!!e.saveData,{downlink:e.downlink,effectiveType:e.effectiveType,rtt:e.rtt,saveData:!!e.saveData})}return{}},getIsLowEndDevice=function(){return!!(WN.hardwareConcurrency&&WN.hardwareConcurrency<=4)||!!(WN.deviceMemory&&WN.deviceMemory<=4)},getIsLowEndExperience=function(e,t){return!!getIsLowEndDevice()||(!!["slow-2g","2g","3g"].includes(e)||!!t)},visibility={t:!1},onVisibilityChange=function(e){void 0!==D.hidden&&D.addEventListener("visibilitychange",didVisibilityChange.bind(this,e))},didVisibilityChange=function(e){D.hidden&&(e(),visibility.t=D.hidden)},reportPerf=function(e){visibility.t&&e.i.indexOf("Hidden")<0||!config.analyticsTracker||config.analyticsTracker({metricName:e.i,data:e.data,eventProperties:e.o?e.o:{},navigatorInformation:e.s})},convertToKB=function(e){return"number"!=typeof e?null:parseFloat((e/Math.pow(1024,2)).toFixed(2))},pushTask=function(e){"requestIdleCallback"in W?W.requestIdleCallback(e,{timeout:3e3}):e()},log=function(e){visibility.t&&e.i.indexOf("Hidden")<0||!config.logging||C.log("%c "+config.logPrefix+" "+e.i+" ","color:#ff6d00;font-size:11px;",e.data,e.s)},logData=function(e,t){Object.keys(t).forEach((function(e){"number"==typeof t[e]&&(t[e]=parseFloat(t[e].toFixed(2)))}));var r=getNavigatorInfo();r.isLowEndDevice=getIsLowEndDevice(),r.isLowEndExperience=getIsLowEndExperience(et,sd),pushTask((function(){log({i:e,data:t,s:r}),reportPerf({i:e,data:t,s:r})}))},logMetric=function(e,t,r){void 0===r&&(r="ms");var i=parseFloat(e.toFixed(2));if(!(i>config.maxMeasureTime||i<=0)){var n=getNavigatorInfo();n.isLowEndDevice=getIsLowEndDevice(),n.isLowEndExperience=getIsLowEndExperience(et,sd),pushTask((function(){log({i:t,data:i+" "+r,s:n}),reportPerf({i:t,data:i,s:n})}))}},logWarn=function(e){config.logging&&C.warn(config.logPrefix,e)},getDurationByMetric=function(e){var t=WP.getEntriesByName(e),r=t[t.length-1];return r&&"measure"===r.entryType?r.duration:-1},performanceMeasure=function(e){var t="mark_"+e+"_start",r="mark_"+e+"_end";return WP.measure(e,t,r),getDurationByMetric(e)},cls={value:0},clsMetricName="cumulativeLayoutShift",fcp={value:0},lcp={value:0},fcpEntryName="first-contentful-paint",lcpMetricName="largestContentfulPaint",rt={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},tbt={value:0},tbtMetricName="totalBlockingTime",initLayoutShift=function(e){var t=e.pop();t&&!t.u&&t.value&&(cls.value+=t.value)},perfObservers={},initFirstInputDelay=function(e){var t=e.pop();t&&logMetric(t.duration,"firstInputDelay"),perfObservers.g.disconnect(),perfObservers.l&&logMetric(lcp.value,lcpMetricName),perfObservers.p&&(perfObservers.p.takeRecords(),logMetric(cls.value,clsMetricName,"")),perfObservers.v&&logMetric(tbt.value,tbtMetricName),setTimeout((function(){perfObservers.v&&logMetric(tbt.value,tbtMetricName+"5S")}),5e3),setTimeout((function(){perfObservers.v&&(logMetric(tbt.value,tbtMetricName+"10S"),perfObservers.v.disconnect()),logData("dataConsumption",rt.value)}),1e4)},po=function(e,t){try{var r=new PerformanceObserver((function(e){var r=e.getEntries();t(r)}));return r.observe({type:e,buffered:!0}),r}catch(e){logWarn(e)}return null},initTotalBlockingTime=function(e){e.forEach((function(e){if(!("self"!==e.name||e.startTime<fcp.value)){var t=e.duration-50;t&&(tbt.value+=t)}}))},initFirstPaint=function(e){e.forEach((function(e){"first-paint"===e.name?logMetric(e.startTime,"firstPaint"):e.name===fcpEntryName&&logMetric(e.startTime,"firstContentfulPaint"),e.name===fcpEntryName&&(fcp.value=e.startTime,perfObservers.v=po("longtask",initTotalBlockingTime),perfObservers.m.disconnect())}))},initLargestContentfulPaint=function(e){var t=e.pop();t&&(lcp.value=t.renderTime||t.loadTime)},initResourceTiming=function(e){e.forEach((function(e){if(config.resourceTiming&&logData("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;rt.value[e.initiatorType]+=t,rt.value.total+=t}}))},initPerformanceObserver=function(){perfObservers.m=po("paint",initFirstPaint),perfObservers.g=po("first-input",initFirstInputDelay),perfObservers.l=po("largest-contentful-paint",initLargestContentfulPaint),config.resourceTiming&&po("resource",initResourceTiming),perfObservers.p=po("layout-shift",initLayoutShift)},disconnectPerfObserversHidden=function(){perfObservers.l&&(logMetric(lcp.value,lcpMetricName+"UntilHidden"),perfObservers.l.disconnect()),perfObservers.p&&(perfObservers.p.takeRecords(),logMetric(cls.value,clsMetricName+"UntilHidden",""),perfObservers.p.disconnect())},initStorageEstimate=function(){WN&&WN.storage&&WN.storage.estimate().then(reportStorageEstimate)},reportStorageEstimate=function(e){var t={};"usageDetails"in e&&(t=e.usageDetails),logData("storageEstimate",{quota:convertToKB(e.quota),usage:convertToKB(e.usage),caches:convertToKB(t.caches),indexedDB:convertToKB(t.indexedDB),serviceWorker:convertToKB(t.serviceWorkerRegistrations)})},logPrefixRecording="Recording already",Perfume=function(){function e(e){void 0===e&&(e={}),this.P="© 2020 Leonardo Zizzamia",this.version="5.0.0-rc.10",this.N={},config.resourceTiming=!!e.resourceTiming,config.logPrefix=e.logPrefix||config.logPrefix,config.logging=!!e.logging,config.maxMeasureTime=e.maxMeasureTime||config.maxMeasureTime,isPerformanceSupported()&&(isPerformanceObserverSupported()&&initPerformanceObserver(),onVisibilityChange(disconnectPerfObserversHidden),logData("navigationTiming",getNavigationTiming()),logData("networkInformation",getNetworkInformation()),initStorageEstimate())}return e.prototype.start=function(e){isPerformanceSupported()&&(this.N[e]?logWarn(logPrefixRecording+" started."):(this.N[e]=!0,WP.mark("mark_"+e+"_start"),visibility.t=!1))},e.prototype.end=function(e,t){if(void 0===t&&(t={}),isPerformanceSupported())if(this.N[e]){WP.mark("mark_"+e+"_end");var r=performanceMeasure(e),i=parseFloat(r.toFixed(2));delete this.N[e],pushTask((function(){var r=getNavigatorInfo();r.isLowEndDevice=getIsLowEndDevice(),r.isLowEndExperience=getIsLowEndExperience(et,sd);var n={i:e,data:i,o:t,s:r};log(n),reportPerf(n)}))}else logWarn(logPrefixRecording+" stopped.")},e.prototype.endPaint=function(e,t){var r=this;setTimeout((function(){r.end(e,t)}))},e.prototype.clear=function(e){delete this.N[e],WP.clearMarks&&(WP.clearMarks("mark_"+e+"_start"),WP.clearMarks("mark_"+e+"_end"))},e}();module.exports=Perfume;
//# sourceMappingURL=perfume.min.js.map

@@ -1,2 +0,2 @@

!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t=t||self).Perfume=i()}(this,(function(){"use strict";var t={resourceTiming:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},i=window.console,n=document,e=window,r=window.navigator,o=window.performance,a=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},s=function(){return r?{deviceMemory:r.deviceMemory?r.deviceMemory:0,hardwareConcurrency:r.hardwareConcurrency?r.hardwareConcurrency:0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported"}:{}},u="4g",f=!1,c=function(){return!!(r.hardwareConcurrency&&r.hardwareConcurrency<=4)||!!(r.deviceMemory&&r.deviceMemory<=4)},m=function(t,i){return!!c()||(!!["slow-2g","2g","3g"].includes(t)||!!i)},h={t:!1},d=function(t){n.hidden&&(t(),h.t=n.hidden)},l=function(i){h.t&&i.i.indexOf("Hidden")<0||!t.analyticsTracker||t.analyticsTracker({metricName:i.i,data:i.data,eventProperties:i.o?i.o:{},navigatorInformation:i.s})},v=function(t){return"number"!=typeof t?null:parseFloat((t/Math.pow(1024,2)).toFixed(2))},g=function(t){"requestIdleCallback"in e?e.requestIdleCallback(t,{timeout:3e3}):t()},p=function(n){h.t&&n.i.indexOf("Hidden")<0||!t.logging||i.log("%c "+t.logPrefix+" "+n.i+" ","color:#ff6d00;font-size:11px;",n.data,n.s)},y=function(t,i){Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var n=s();n.isLowEndDevice=c(),n.isLowEndExperience=m(u,f),g((function(){p({i:t,data:i,s:n}),l({i:t,data:i,s:n})}))},T=function(i,n,e){void 0===e&&(e="ms");var r=parseFloat(i.toFixed(2));if(!(r>t.maxMeasureTime||r<=0)){var o=s();o.isLowEndDevice=c(),o.isLowEndExperience=m(u,f),g((function(){p({i:n,data:r+" "+e,s:o}),l({i:n,data:r,s:o})}))}},k=function(n){t.logging&&i.warn(t.logPrefix,n)},w=function(t,i){try{var n=new PerformanceObserver((function(t){var n=t.getEntries();i(n)}));return n.observe({type:t,buffered:!0}),n}catch(t){k(t)}return null},_=function(t){var i={};"usageDetails"in t&&(i=t.usageDetails),y("storageEstimate",{storageEstimateQuota:v(t.quota),storageEstimateUsage:v(t.usage),storageEstimateCaches:v(i.caches),storageEstimateIndexedDB:v(i.indexedDB),storageEstimatSW:v(i.serviceWorkerRegistrations)})},b=0,E=0,I=0;return function(){function i(i){void 0===i&&(i={}),this.u="© 2020 Leonardo Zizzamia",this.version="5.0.0-rc.9",this.m="Recording already",this.h={},this.l={},this.v={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.g=0,t.resourceTiming=!!i.resourceTiming,t.logPrefix=i.logPrefix||t.logPrefix,t.logging=!!i.logging,t.maxMeasureTime=i.maxMeasureTime||t.maxMeasureTime,a()&&("PerformanceObserver"in e&&this.p(),function(t){void 0!==n.hidden&&n.addEventListener("visibilitychange",d.bind(this,t))}(this.T),y("navigationTiming",function(){if(!a())return{};var t=o.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,n=t.responseEnd;return{fetchTime:n-t.fetchStart,workerTime:t.workerStart>0?n-t.workerStart:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}}()),y("networkInformation",function(){if("connection"in r){var t=r.connection;return"object"!=typeof t?{}:(u=t.effectiveType,f=!!t.saveData,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(_))}return i.prototype.start=function(t){a()&&(this.h[t]?k(this.m+" started."):(this.h[t]=!0,o.mark("mark_"+t+"_start"),h.t=!1))},i.prototype.end=function(t,i){if(void 0===i&&(i={}),a())if(this.h[t]){o.mark("mark_"+t+"_end");var n=this.k(t),e=parseFloat(n.toFixed(2));delete this.h[t],g((function(){var n=s();n.isLowEndDevice=c(),n.isLowEndExperience=m(u,f);var r={i:t,data:e,o:i,s:n};p(r),l(r)}))}else k(this.m+" stopped.")},i.prototype.endPaint=function(t,i){var n=this;setTimeout((function(){n.end(t,i)}))},i.prototype.clear=function(t){delete this.h[t],o.clearMarks&&(o.clearMarks("mark_"+t+"_start"),o.clearMarks("mark_"+t+"_end"))},i.prototype._=function(t){this.I({N:t,i:"firstInputDelay",P:"duration"}),this.C(I,E),this.L(),this.S()},i.prototype.L=function(){this.B&&(clearTimeout(this.B),this.B=void 0,y("dataConsumption",this.v))},i.prototype.C=function(t,i){this.l.D&&t&&T(t,"largestContentfulPaint"),this.l.F&&i>0&&(this.l.F.takeRecords(),T(i,"cumulativeLayoutShift","")),this.l.H&&this.g&&T(this.g,"totalBlockingTime")},i.prototype.T=function(){this.l.D&&I&&(T(I,"largestContentfulPaintUntilHidden"),this.l.D.disconnect()),this.l.F&&E>0&&(this.l.F.takeRecords(),T(E,"cumulativeLayoutShiftUntilHidden",""),this.l.F.disconnect())},i.prototype.S=function(){var t=this;setTimeout((function(){t.l.H&&t.g&&T(t.g,"totalBlockingTime5S")}),5e3),setTimeout((function(){t.l.H&&(t.g&&T(t.g,"totalBlockingTime10S"),t.l.H.disconnect())}),1e4)},i.prototype.j=function(){this.l.M=w("first-input",this._.bind(this))},i.prototype.O=function(){var t=this;this.l.U=w("paint",(function(i){t.I({N:i,W:"first-paint",i:"firstPaint",P:"startTime"}),t.I({N:i,W:"first-contentful-paint",i:"firstContentfulPaint",P:"startTime"})}))},i.prototype.q=function(){this.l.D=w("largest-contentful-paint",(function(t){var i=t.pop();i&&(I=i.renderTime||i.loadTime)}))},i.prototype.R=function(){this.l.F=w("layout-shift",(function(t){var i=t.pop();i&&!i.Z&&i.value&&(E+=i.value)}))},i.prototype.p=function(){this.O(),this.j(),this.q(),t.resourceTiming&&this.A(),this.R()},i.prototype.A=function(){var t=this;w("resource",(function(i){t.G({N:i})})),this.B=setTimeout((function(){t.L()}),15e3)},i.prototype.J=function(){var t=this;this.l.H=w("longtask",(function(i){t.K({N:i})}))},i.prototype.V=function(t){var i=o.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},i.prototype.k=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return o.measure(t,i,n),this.V(t)},i.prototype.I=function(t){var i=this;t.N.forEach((function(n){(!t.W||t.W&&n.name===t.W)&&T(n[t.P],t.i),i.l.U&&"first-contentful-paint"===n.name&&(b=n.startTime,i.J(),i.l.U.disconnect())})),this.l.M&&"firstInputDelay"===t.i&&this.l.M.disconnect()},i.prototype.G=function(i){var n=this;i.N.forEach((function(i){if(t.resourceTiming&&y("resourceTiming",i),i.decodedBodySize&&i.initiatorType){var e=i.decodedBodySize/1e3;n.v[i.initiatorType]+=e,n.v.total+=e}}))},i.prototype.K=function(t){var i=this;t.N.forEach((function(t){if(!("self"!==t.name||t.startTime<b)){var n=t.duration-50;n&&(i.g+=n)}}))},i}()}));
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).Perfume=n()}(this,(function(){"use strict";var t={resourceTiming:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},n=window.console,e=document,i=window,r=window.navigator,o=window.performance,a=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},u=function(){return r?{deviceMemory:r.deviceMemory?r.deviceMemory:0,hardwareConcurrency:r.hardwareConcurrency?r.hardwareConcurrency:0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported"}:{}},f="4g",c=!1,s=function(){return!!(r.hardwareConcurrency&&r.hardwareConcurrency<=4)||!!(r.deviceMemory&&r.deviceMemory<=4)},d=function(t,n){return!!s()||(!!["slow-2g","2g","3g"].includes(t)||!!n)},l={t:!1},m=function(t){e.hidden&&(t(),l.t=e.hidden)},v=function(n){l.t&&n.i.indexOf("Hidden")<0||!t.analyticsTracker||t.analyticsTracker({metricName:n.i,data:n.data,eventProperties:n.o?n.o:{},navigatorInformation:n.u})},g=function(t){return"number"!=typeof t?null:parseFloat((t/Math.pow(1024,2)).toFixed(2))},p=function(t){"requestIdleCallback"in i?i.requestIdleCallback(t,{timeout:3e3}):t()},h=function(e){l.t&&e.i.indexOf("Hidden")<0||!t.logging||n.log("%c "+t.logPrefix+" "+e.i+" ","color:#ff6d00;font-size:11px;",e.data,e.u)},y=function(t,n){Object.keys(n).forEach((function(t){"number"==typeof n[t]&&(n[t]=parseFloat(n[t].toFixed(2)))}));var e=u();e.isLowEndDevice=s(),e.isLowEndExperience=d(f,c),p((function(){h({i:t,data:n,u:e}),v({i:t,data:n,u:e})}))},k=function(n,e,i){void 0===i&&(i="ms");var r=parseFloat(n.toFixed(2));if(!(r>t.maxMeasureTime||r<=0)){var o=u();o.isLowEndDevice=s(),o.isLowEndExperience=d(f,c),p((function(){h({i:e,data:r+" "+i,u:o}),v({i:e,data:r,u:o})}))}},T=function(e){t.logging&&n.warn(t.logPrefix,e)},w=function(t){var n="mark_"+t+"_start",e="mark_"+t+"_end";return o.measure(t,n,e),function(t){var n=o.getEntriesByName(t),e=n[n.length-1];return e&&"measure"===e.entryType?e.duration:-1}(t)},_={value:0},b={value:0},P={value:0},I={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},x={value:0},C=function(t){var n=t.pop();n&&!n.s&&n.value&&(_.value+=n.value)},N={},S=function(t){var n=t.pop();n&&k(n.duration,"firstInputDelay"),N.l.disconnect(),N.m&&k(P.value,"largestContentfulPaint"),N.v&&(N.v.takeRecords(),k(_.value,"cumulativeLayoutShift","")),N.g&&k(x.value,"totalBlockingTime"),setTimeout((function(){N.g&&k(x.value,"totalBlockingTime5S")}),5e3),setTimeout((function(){N.g&&(k(x.value,"totalBlockingTime10S"),N.g.disconnect()),y("dataConsumption",I.value)}),1e4)},B=function(t,n){try{var e=new PerformanceObserver((function(t){var e=t.getEntries();n(e)}));return e.observe({type:t,buffered:!0}),e}catch(t){T(t)}return null},F=function(t){t.forEach((function(t){if(!("self"!==t.name||t.startTime<b.value)){var n=t.duration-50;n&&(x.value+=n)}}))},H=function(t){t.forEach((function(t){"first-paint"===t.name?k(t.startTime,"firstPaint"):"first-contentful-paint"===t.name&&k(t.startTime,"firstContentfulPaint"),"first-contentful-paint"===t.name&&(b.value=t.startTime,N.g=B("longtask",F),N.p.disconnect())}))},j=function(t){var n=t.pop();n&&(P.value=n.renderTime||n.loadTime)},z=function(n){n.forEach((function(n){if(t.resourceTiming&&y("resourceTiming",n),n.decodedBodySize&&n.initiatorType){var e=n.decodedBodySize/1e3;I.value[n.initiatorType]+=e,I.value.total+=e}}))},D=function(){N.m&&(k(P.value,"largestContentfulPaintUntilHidden"),N.m.disconnect()),N.v&&(N.v.takeRecords(),k(_.value,"cumulativeLayoutShiftUntilHidden",""),N.v.disconnect())},L=function(t){var n={};"usageDetails"in t&&(n=t.usageDetails),y("storageEstimate",{quota:g(t.quota),usage:g(t.usage),caches:g(n.caches),indexedDB:g(n.indexedDB),serviceWorker:g(n.serviceWorkerRegistrations)})};return function(){function n(n){void 0===n&&(n={}),this.h="© 2020 Leonardo Zizzamia",this.version="5.0.0-rc.10",this.k={},t.resourceTiming=!!n.resourceTiming,t.logPrefix=n.logPrefix||t.logPrefix,t.logging=!!n.logging,t.maxMeasureTime=n.maxMeasureTime||t.maxMeasureTime,a()&&("PerformanceObserver"in i&&(N.p=B("paint",H),N.l=B("first-input",S),N.m=B("largest-contentful-paint",j),t.resourceTiming&&B("resource",z),N.v=B("layout-shift",C)),function(t){void 0!==e.hidden&&e.addEventListener("visibilitychange",m.bind(this,t))}(D),y("navigationTiming",function(){if(!a())return{};var t=o.getEntriesByType("navigation")[0];if(!t)return{};var n=t.responseStart,e=t.responseEnd;return{fetchTime:e-t.fetchStart,workerTime:t.workerStart>0?e-t.workerStart:0,totalTime:e-t.requestStart,downloadTime:e-n,timeToFirstByte:n-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}}()),y("networkInformation",function(){if("connection"in r){var t=r.connection;return"object"!=typeof t?{}:(f=t.effectiveType,c=!!t.saveData,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(L))}return n.prototype.start=function(t){a()&&(this.k[t]?T("Recording already started."):(this.k[t]=!0,o.mark("mark_"+t+"_start"),l.t=!1))},n.prototype.end=function(t,n){if(void 0===n&&(n={}),a())if(this.k[t]){o.mark("mark_"+t+"_end");var e=w(t),i=parseFloat(e.toFixed(2));delete this.k[t],p((function(){var e=u();e.isLowEndDevice=s(),e.isLowEndExperience=d(f,c);var r={i:t,data:i,o:n,u:e};h(r),v(r)}))}else T("Recording already stopped.")},n.prototype.endPaint=function(t,n){var e=this;setTimeout((function(){e.end(t,n)}))},n.prototype.clear=function(t){delete this.k[t],o.clearMarks&&(o.clearMarks("mark_"+t+"_start"),o.clearMarks("mark_"+t+"_end"))},n}()}));
//# sourceMappingURL=perfume.umd.min.js.map

@@ -1,6 +0,2 @@

import { IPerformanceObserverType } from './types';
/**
* PerformanceObserver subscribes to performance events as they happen
* and respond to them asynchronously.
*/
export declare const po: (eventType: IPerformanceObserverType, cb: (performanceEntries: any[]) => void) => PerformanceObserver | null;
export declare const initPerformanceObserver: () => void;
export declare const disconnectPerfObserversHidden: () => void;
/*!
* Perfume.js v5.0.0-rc.9 (http://zizzamia.github.io/perfume)
* Perfume.js v5.0.0-rc.10 (http://zizzamia.github.io/perfume)
* Copyright 2020 Leonardo Zizzamia (https://github.com/Zizzamia/perfume.js/graphs/contributors)

@@ -11,8 +11,3 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE)

version: string;
private dataConsumptionTimeout;
private logPrefixRecording;
private metrics;
private perfObservers;
private perfResourceTiming;
private totalBlockingTimeScore;
constructor(options?: IPerfumeOptions);

@@ -35,34 +30,2 @@ /**

clear(markName: string): void;
private digestFirstInputDelayEntries;
private disconnectDataConsumption;
private disconnectPerfObservers;
private disconnectPerfObserversHidden;
private disconnecTotalBlockingTime;
private initFirstInputDelay;
/**
* First Paint is essentially the paint after which
* the biggest above-the-fold layout change has happened.
*/
private initFirstPaint;
private initLargestContentfulPaint;
/**
* Detects new layout shift occurrences and updates the
* `cumulativeLayoutShiftScore` variable.
*/
private initLayoutShift;
private initPerformanceObserver;
private initResourceTiming;
private initTotalBlockingTime;
/**
* Get the duration of the timing metric or -1 if there a measurement has
* not been made by the User Timing API
*/
private getDurationByMetric;
private performanceMeasure;
/**
* Logging Performance Paint Timing
*/
private performanceObserverCb;
private performanceObserverResourceCb;
private performanceObserverTBTCb;
}

@@ -47,3 +47,2 @@ export interface IAnalyticsTrackerOptions {

}
export declare type IPerfumeMetrics = 'firstContentfulPaint' | 'firstPaint' | 'firstInputDelay';
export declare type IPerformanceObserverType = 'first-input' | 'largest-contentful-paint' | 'layout-shift' | 'longtask' | 'measure' | 'navigation' | 'paint' | 'resource';

@@ -50,0 +49,0 @@ export declare type IPerformanceEntryInitiatorType = 'beacon' | 'css' | 'fetch' | 'img' | 'other' | 'script' | 'xmlhttprequest';

{
"name": "perfume.js",
"version": "5.0.0-rc.9",
"version": "5.0.0-rc.10",
"description": "Tiny web performance monitoring library which reports field data back to your favorite analytics tool.",

@@ -92,3 +92,3 @@ "keywords": [

"branches": 83,
"functions": 98,
"functions": 93,
"lines": 93,

@@ -95,0 +95,0 @@ "statements": 93

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc