223 lines
6.8 KiB
JavaScript
223 lines
6.8 KiB
JavaScript
// Metro module 318 (f319).
|
|
import _createClass from "./_createClass";
|
|
import _classCallCheck from "./_classCallCheck";
|
|
let c330_2;
|
|
let FillRateHelper;
|
|
let env330 = {};
|
|
const Info = function Info() {
|
|
_classCallCheck(this, Info);
|
|
this.any_blank_count = 0;
|
|
this.any_blank_ms = 0;
|
|
this.any_blank_speed_sum = 0;
|
|
this.mostly_blank_count = 0;
|
|
this.mostly_blank_ms = 0;
|
|
this.pixels_blank = 0;
|
|
this.pixels_sampled = 0;
|
|
this.pixels_scrolled = 0;
|
|
this.total_time_spent = 0;
|
|
this.sample_count = 0;
|
|
};
|
|
c330_2 = _createClass(Info);
|
|
env330[3] = [];
|
|
env330[4] = 10;
|
|
env330[5] = null;
|
|
FillRateHelper = function FillRateHelper(a0) {
|
|
_classCallCheck(this, FillRateHelper);
|
|
this._anyBlankStartTime = null;
|
|
this._enabled = false;
|
|
this._info = new c330_2();
|
|
this._mostlyBlankStartTime = null;
|
|
this._samplesStartTime = null;
|
|
this._listMetrics = a0;
|
|
this._enabled = (env330[5] || 0) > Math.random();
|
|
this._resetData();
|
|
};
|
|
export default _createClass(FillRateHelper, [{
|
|
key: "activate",
|
|
value: function activate() {
|
|
if (this._enabled && this._samplesStartTime == null) {
|
|
this._samplesStartTime = global.performance.now();
|
|
}
|
|
}
|
|
}, {
|
|
key: "deactivateAndFlush",
|
|
value: function deactivateAndFlush() {
|
|
if (this._enabled) {
|
|
const _samplesStartTime = this._samplesStartTime;
|
|
if (_samplesStartTime != null) {
|
|
if (this._info.sample_count < env330[4]) {
|
|
this._resetData();
|
|
} else {
|
|
let c23650_0 = {
|
|
...this._info,
|
|
total_time_spent: global.performance.now() - _samplesStartTime
|
|
};
|
|
env330[3].forEach((item) => item(c23650_0));
|
|
this._resetData();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: "computeBlankness",
|
|
value: function computeBlankness(a0, a1, a2) {
|
|
let r68, r69, r91, r92;
|
|
if (this._enabled && a0.getItemCount(a0.data) !== 0 && !(a1.last < a1.first) && this._samplesStartTime != null) {
|
|
const { dOffset, offset, velocity, visibleLength } = a2;
|
|
const _info = this._info;
|
|
_info.sample_count = _info.sample_count + 1;
|
|
const _info2 = this._info;
|
|
_info2.pixels_sampled = _info2.pixels_sampled + Math.round(visibleLength);
|
|
const _info3 = this._info;
|
|
_info3.pixels_scrolled = _info3.pixels_scrolled + Math.round(Math.abs(dOffset));
|
|
const r46 = Math.round(1000 * Math.abs(velocity));
|
|
const _anyBlankStartTime = global.performance.now();
|
|
if (this._anyBlankStartTime != null) {
|
|
const _info4 = this._info;
|
|
_info4.any_blank_ms = _info4.any_blank_ms + (_anyBlankStartTime - this._anyBlankStartTime);
|
|
}
|
|
this._anyBlankStartTime = null;
|
|
if (this._mostlyBlankStartTime != null) {
|
|
const _info5 = this._info;
|
|
_info5.mostly_blank_ms = _info5.mostly_blank_ms + (_anyBlankStartTime - this._mostlyBlankStartTime);
|
|
}
|
|
L14: {
|
|
this._mostlyBlankStartTime = null;
|
|
const first = a1.first;
|
|
const cellMetrics2 = this._listMetrics.getCellMetrics(first, a0);
|
|
const last = a1.last;
|
|
r68 = cellMetrics2;
|
|
r69 = first;
|
|
if (first <= last) {
|
|
let r70 = first;
|
|
if (cellMetrics2) {
|
|
const isMounted = cellMetrics2.isMounted;
|
|
r70 = first;
|
|
r68 = cellMetrics2;
|
|
r69 = r70;
|
|
if (isMounted) {
|
|
break L14;
|
|
}
|
|
}
|
|
while (true) {
|
|
const cellMetrics3 = this._listMetrics.getCellMetrics(r70, a0);
|
|
const r75 = r70 + 1;
|
|
const last2 = a1.last;
|
|
r68 = cellMetrics3;
|
|
r69 = r75;
|
|
if (!(r75 <= last2)) {
|
|
break;
|
|
}
|
|
r70 = r75;
|
|
if (cellMetrics3) {
|
|
const isMounted2 = cellMetrics3.isMounted;
|
|
r70 = r75;
|
|
r68 = cellMetrics3;
|
|
r69 = r70;
|
|
if (isMounted2) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const r79 = r68 && r69 > 0 ? Math.min(visibleLength, Math.max(0, r68.offset - offset)) : 0;
|
|
L24: {
|
|
const last3 = a1.last;
|
|
const cellMetrics = this._listMetrics.getCellMetrics(last3, a0);
|
|
const first2 = a1.first;
|
|
r91 = cellMetrics;
|
|
r92 = last3;
|
|
if (last3 >= first2) {
|
|
let r93 = last3;
|
|
if (cellMetrics) {
|
|
const isMounted3 = cellMetrics.isMounted;
|
|
r93 = last3;
|
|
r91 = cellMetrics;
|
|
r92 = r93;
|
|
if (isMounted3) {
|
|
break L24;
|
|
}
|
|
}
|
|
while (true) {
|
|
const cellMetrics4 = this._listMetrics.getCellMetrics(r93, a0);
|
|
const r98 = r93 - 1;
|
|
const first3 = a1.first;
|
|
r91 = cellMetrics4;
|
|
r92 = r98;
|
|
if (!(r98 >= first3)) {
|
|
break;
|
|
}
|
|
r93 = r98;
|
|
if (cellMetrics4) {
|
|
const isMounted4 = cellMetrics4.isMounted;
|
|
r93 = r98;
|
|
r91 = cellMetrics4;
|
|
r92 = r93;
|
|
if (isMounted4) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const r121 = Math.round(r79 + (r91 ? r92 < a0.getItemCount(a0.data) - 1 ? Math.min(visibleLength, Math.max(0, offset + visibleLength - (r91.offset + r91.length))) : 0 : 0));
|
|
const r122 = r121 / visibleLength;
|
|
if (r122 > 0) {
|
|
this._anyBlankStartTime = _anyBlankStartTime;
|
|
const _info6 = this._info;
|
|
_info6.any_blank_speed_sum = _info6.any_blank_speed_sum + r46;
|
|
const _info7 = this._info;
|
|
_info7.any_blank_count = _info7.any_blank_count + 1;
|
|
const _info8 = this._info;
|
|
_info8.pixels_blank = _info8.pixels_blank + r121;
|
|
if (r122 > 0.5) {
|
|
this._mostlyBlankStartTime = _anyBlankStartTime;
|
|
const _info9 = this._info;
|
|
_info9.mostly_blank_count = _info9.mostly_blank_count + 1;
|
|
}
|
|
} else if (r46 < 0.01 || Math.abs(dOffset) < 1) {
|
|
this.deactivateAndFlush();
|
|
}
|
|
return r122;
|
|
}
|
|
return 0;
|
|
}
|
|
}, {
|
|
key: "enabled",
|
|
value: function enabled() {
|
|
return this._enabled;
|
|
}
|
|
}, {
|
|
key: "_resetData",
|
|
value: function _resetData() {
|
|
this._anyBlankStartTime = null;
|
|
this._info = new c330_2();
|
|
this._mostlyBlankStartTime = null;
|
|
this._samplesStartTime = null;
|
|
}
|
|
}], [{
|
|
key: "addListener",
|
|
value: function addListener(a0) {
|
|
if (env330[5] === null) {
|
|
console.warn("Call `FillRateHelper.setSampleRate` before `addListener`.");
|
|
}
|
|
env330[3].push(a0);
|
|
return {
|
|
remove: () => {
|
|
env330[3] = env330[3].filter((item) => a0 !== item);
|
|
}
|
|
};
|
|
}
|
|
}, {
|
|
key: "setSampleRate",
|
|
value: function setSampleRate(a0) {
|
|
env330[5] = a0;
|
|
}
|
|
}, {
|
|
key: "setMinSampleCount",
|
|
value: function setMinSampleCount(a0) {
|
|
env330[4] = a0;
|
|
}
|
|
}]);
|