426 lines
16 KiB
React
426 lines
16 KiB
React
/* Metro module 6472; source: unknown; dependencies: [6450] */
|
|
function _fun50896(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#50896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6650:6, offset: 0x01224a38, size: 97 bytes, params: 8, frame: 16
|
|
const value = this;
|
|
const env0_0 = require;
|
|
if (value && value.__spreadArray) {
|
|
}
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
exports.default = _fun50898();
|
|
}
|
|
|
|
function _fun50898() { // fn#50898, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6650:323, offset: 0x01224a99, size: 507 bytes, params: 1, frame: 4
|
|
const closure = ViewabilityTracker;
|
|
closure.prototype.init = function(a0) {
|
|
this._doInitialFit(this._currentOffset, a0);
|
|
};
|
|
closure.prototype.setLayouts = function(a0, a1) {
|
|
this._layouts = a0;
|
|
this._maxOffset = a1;
|
|
};
|
|
closure.prototype.setDimensions = function(a0, a1) {
|
|
this._isHorizontal = a1;
|
|
this._windowBound = a1 ? a0.width : a0.height;
|
|
};
|
|
closure.prototype.forceRefresh = function() {
|
|
var r0;
|
|
r0 = this._actualOffset >= 0 && this._currentOffset >= this._maxOffset - this._windowBound;
|
|
this.forceRefreshWithOffset(this._currentOffset);
|
|
return r0;
|
|
};
|
|
closure.prototype.forceRefreshWithOffset = function(a0) {
|
|
this._currentOffset = -1;
|
|
this.updateOffset(a0, false, this._defaultCorrection);
|
|
};
|
|
closure.prototype.updateOffset = updateOffset_50906;
|
|
closure.prototype.getLastOffset = function() {
|
|
return this._currentOffset;
|
|
};
|
|
closure.prototype.getLastActualOffset = function() {
|
|
return this._actualOffset;
|
|
};
|
|
closure.prototype.getEngagedIndexes = function() {
|
|
return this._engagedIndexes;
|
|
};
|
|
closure.prototype.findFirstLogicallyVisibleIndex = findFirstLogicallyVisibleIndex;
|
|
closure.prototype.updateRenderAheadOffset = function(a0) {
|
|
var Math = global.Math;
|
|
this._renderAheadOffset = Math.max(0, a0);
|
|
this.forceRefreshWithOffset(this._currentOffset);
|
|
};
|
|
closure.prototype.getCurrentRenderAheadOffset = function() {
|
|
return this._renderAheadOffset;
|
|
};
|
|
closure.prototype.setActualOffset = function(a0) {
|
|
this._actualOffset = a0;
|
|
};
|
|
closure.prototype._findFirstVisibleIndexOptimally = function() {
|
|
return this._currentOffset > 5000 ? this._findFirstVisibleIndexUsingBS() : this._currentOffset > 0 ? this._findFirstVisibleIndexLinearly() : 0;
|
|
};
|
|
closure.prototype._fitAndUpdate = function(a0) {
|
|
var items = [];
|
|
var items2 = [];
|
|
this._fitIndexes(items, items2, a0, true);
|
|
this._fitIndexes(items, items2, a0 + 1, false);
|
|
this._diffUpdateOriginalIndexesAndRaiseEvents(items, items2);
|
|
};
|
|
closure.prototype._doInitialFit = function(a0, a1) {
|
|
var Math = global.Math;
|
|
var _maxOffset = this._maxOffset;
|
|
var Math2 = global.Math;
|
|
this._updateTrackingWindows(Math.min(_maxOffset, Math2.max(0, a0)), a1);
|
|
this._fitAndUpdate(this._findFirstVisibleIndexOptimally());
|
|
};
|
|
closure.prototype._findFirstVisibleIndexLinearly = function() {
|
|
var r2;
|
|
var property;
|
|
var start;
|
|
var value2;
|
|
var length = this._layouts.length;
|
|
var object = {'start': 0, 'end': 0};
|
|
var value = 0;
|
|
if (value < length) {
|
|
r2 = value;
|
|
loopExit1: while (true) {
|
|
property = this._layouts[r2];
|
|
this._setRelevantBounds(property, object);
|
|
start = object.start;
|
|
if (this._itemIntersectsVisibleWindow(start, object.end)) {
|
|
return r2;
|
|
}
|
|
value2 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value2 < length) {
|
|
r2 = value2;
|
|
continue;
|
|
}
|
|
break loopExit1;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
closure.prototype._findFirstVisibleIndexUsingBS = _findFirstVisibleIndexUsingBS;
|
|
closure.prototype._fitIndexes = _fitIndexes;
|
|
closure.prototype._checkIntersectionAndReport = _checkIntersectionAndReport;
|
|
closure.prototype._setRelevantBounds = function(a0, a1) {
|
|
if (this._isHorizontal) {
|
|
a1.end = a0.x + a0.width;
|
|
a1.start = a0.x;
|
|
} else {
|
|
a1.end = a0.y + a0.height;
|
|
a1.start = a0.y;
|
|
}
|
|
};
|
|
closure.prototype._isItemInBounds = function(a0, a1) {
|
|
return a0.start < a1 && a0.end > a1;
|
|
};
|
|
closure.prototype._isItemBoundsBeyondWindow = function(a0, a1, a2) {
|
|
return a0.start >= a1 && a0.end <= a2;
|
|
};
|
|
closure.prototype._isZeroHeightEdgeElement = function(a0, a1, a2) {
|
|
return a1 - a2 == 0 && (a0.start === a1 || a0.end === a2);
|
|
};
|
|
closure.prototype._itemIntersectsWindow = function(a0, a1, a2) {
|
|
var r0;
|
|
r0 = this._isItemInBounds(a0, a1) || this._isItemInBounds(a0, a2);
|
|
r0 = !r0 ? this._isItemBoundsBeyondWindow(a0, a1, a2) : r0;
|
|
r0 = !r0 ? this._isZeroHeightEdgeElement(a0, a1, a2) : r0;
|
|
return r0;
|
|
};
|
|
closure.prototype._itemIntersectsEngagedWindow = function(a0, a1) {
|
|
return this._itemIntersectsWindow(this._engagedWindow, a0, a1);
|
|
};
|
|
closure.prototype._itemIntersectsVisibleWindow = function(a0, a1) {
|
|
return this._itemIntersectsWindow(this._visibleWindow, a0, a1);
|
|
};
|
|
closure.prototype._updateTrackingWindows = _updateTrackingWindows;
|
|
closure.prototype._diffUpdateOriginalIndexesAndRaiseEvents = function(a0, a1) {
|
|
this._diffArraysAndCallFunc(a0, this._visibleIndexes, this.onVisibleRowsChanged);
|
|
this._diffArraysAndCallFunc(a1, this._engagedIndexes, this.onEngagedRowsChanged);
|
|
this._visibleIndexes = a0;
|
|
this._engagedIndexes = a1;
|
|
};
|
|
closure.prototype._diffArraysAndCallFunc = _diffArraysAndCallFunc;
|
|
closure.prototype._calculateArrayDiff = function(a0, a1) {
|
|
var r1;
|
|
var property;
|
|
var value3;
|
|
var length = a0.length;
|
|
var items = [];
|
|
var value = 0;
|
|
if (value < length) {
|
|
r1 = value;
|
|
while (true) {
|
|
property = require(dependencyMap[value]).default;
|
|
if (property.findIndexOf(a1, a0[r1]) === -1) {
|
|
items.push(a0[r1]);
|
|
}
|
|
value3 = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
|
|
if (value3 < length) {
|
|
r1 = value3;
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
return items;
|
|
};
|
|
return closure;
|
|
}
|
|
|
|
function ViewabilityTracker(a0, a1) { // fn#50899, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6650:334, offset: 0x01224c94, size: 201 bytes, params: 3, frame: 14
|
|
this._layouts = [];
|
|
this._valueExtractorForBinarySearch = _valueExtractorForBinarySearch;
|
|
const Math = global.Math;
|
|
this._currentOffset = Math.max(0, a1);
|
|
this._maxOffset = 0;
|
|
this._actualOffset = 0;
|
|
this._renderAheadOffset = a0;
|
|
this._visibleWindow = {'start': 0, 'end': 0};
|
|
this._engagedWindow = {'start': 0, 'end': 0};
|
|
this._isHorizontal = false;
|
|
this._windowBound = 0;
|
|
this._visibleIndexes = [];
|
|
this._engagedIndexes = [];
|
|
this.onVisibleRowsChanged = null;
|
|
this.onEngagedRowsChanged = null;
|
|
this._relevantDim = {'start': 0, 'end': 0};
|
|
this._defaultCorrection = {'startCorrection': 0, 'endCorrection': 0, 'windowShift': 0};
|
|
}
|
|
|
|
function updateOffset_50906(a0, a1, a2) { // fn#50906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6650:1635, offset: 0x01224e57, size: 163 bytes, params: 4, frame: 20
|
|
var r0;
|
|
var Math;
|
|
var min;
|
|
var _maxOffset;
|
|
var Math2;
|
|
var length;
|
|
let value = a0;
|
|
if (a1) {
|
|
this._actualOffset = value;
|
|
Math = global.Math;
|
|
min = Math.min;
|
|
_maxOffset = this._maxOffset;
|
|
Math2 = global.Math;
|
|
r0 = Reflect.apply(min, Math, [_maxOffset, Math2.max(0, value + (a2.windowShift + a2.startCorrection))]);
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
if (this._currentOffset !== r0) {
|
|
this._currentOffset = r0;
|
|
this._updateTrackingWindows(value, a2);
|
|
length = this._visibleIndexes.length;
|
|
value = 0;
|
|
this._fitAndUpdate(length > value ? this._visibleIndexes[value] : value);
|
|
}
|
|
}
|
|
|
|
function findFirstLogicallyVisibleIndex() { // fn#50910, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6650:2251, offset: 0x01224f1b, size: 136 bytes, params: 1, frame: 17
|
|
var r1;
|
|
var r3;
|
|
var r0;
|
|
var _isHorizontal;
|
|
var _layouts;
|
|
var property;
|
|
var y;
|
|
var y2;
|
|
var x;
|
|
var x2;
|
|
var value3;
|
|
const value = this._findFirstVisibleIndexUsingBS(0.001);
|
|
const value2 = value - 1;
|
|
if (value2 >= 0) {
|
|
r1 = value;
|
|
r3 = value2;
|
|
reducibleLoop1: while (true) {
|
|
_isHorizontal = this._isHorizontal;
|
|
_layouts = this._layouts;
|
|
property = _layouts[value];
|
|
if (_isHorizontal) {
|
|
x = property.x;
|
|
_layouts = this._layouts;
|
|
x2 = _layouts[r3].x;
|
|
reducibleJoin4: while (true) {
|
|
if (x !== x2) {
|
|
r0 = r1;
|
|
break reducibleLoop1;
|
|
}
|
|
break reducibleJoin4;
|
|
}
|
|
} else {
|
|
y = property.y;
|
|
_layouts = this._layouts;
|
|
y2 = _layouts[r3].y;
|
|
reducibleJoin4: while (true) {
|
|
if (y !== y2) {
|
|
r0 = r1;
|
|
break reducibleLoop1;
|
|
}
|
|
break reducibleJoin4;
|
|
}
|
|
}
|
|
value3 = typeof r3 === 'bigint' ? r3 - 1n : +r3 - 1;
|
|
if (value3 >= 0) {
|
|
r1 = r3;
|
|
r3 = value3;
|
|
continue reducibleLoop1;
|
|
}
|
|
r0 = r3;
|
|
break reducibleLoop1;
|
|
}
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _findFirstVisibleIndexUsingBS(a0) { // fn#50918, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6650:3720, offset: 0x0122513a, size: 88 bytes, params: 2, frame: 17
|
|
let value = a0;
|
|
const r5 = value !== undefined ? value : 0;
|
|
const length = this._layouts.length;
|
|
value = environment.__proto__;
|
|
const property = (require(6450) /* metro dependency 6450 */).default;
|
|
return property.findClosestHigherValueIndex(length, this._visibleWindow.start + r5,
|
|
this._valueExtractorForBinarySearch);
|
|
}
|
|
|
|
function _fitIndexes(a0, a1, a2, a3) { // fn#50919, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6650:3937, offset: 0x01225192, size: 177 bytes, params: 5, frame: 26
|
|
var r0;
|
|
var r1;
|
|
var r11;
|
|
var r5;
|
|
var r8;
|
|
var value2;
|
|
var _checkIntersectionAndReport;
|
|
var value3;
|
|
var value4;
|
|
let value = a2;
|
|
const length = this._layouts.length;
|
|
const object2 = {'start': 0, 'end': 0};
|
|
reducibleJoin10: while (true) {
|
|
if (!(value < length)) {
|
|
break reducibleJoin10;
|
|
}
|
|
if (a3) {
|
|
value4 = false;
|
|
if (!(value >= 0)) {
|
|
break reducibleJoin10;
|
|
}
|
|
r1 = value4;
|
|
r5 = value;
|
|
reducibleLoop7: while (true) {
|
|
_checkIntersectionAndReport = this._checkIntersectionAndReport;
|
|
value = true;
|
|
if (Reflect.apply(_checkIntersectionAndReport, this, [r5, value, object2, a0, a1])) {
|
|
r8 = value;
|
|
} else {
|
|
reducibleJoin9: while (true) {
|
|
if (r1) {
|
|
break reducibleJoin10;
|
|
}
|
|
r8 = r1;
|
|
break reducibleJoin9;
|
|
}
|
|
}
|
|
value = typeof r5 === 'bigint' ? r5 - 1n : +r5 - 1;
|
|
if (value >= 0) {
|
|
r1 = r8;
|
|
r5 = value;
|
|
continue reducibleLoop7;
|
|
}
|
|
break reducibleJoin10;
|
|
}
|
|
} else {
|
|
value2 = false;
|
|
if (!(value < length)) {
|
|
break reducibleJoin10;
|
|
}
|
|
r0 = value2;
|
|
r1 = value;
|
|
reducibleLoop3: while (true) {
|
|
_checkIntersectionAndReport = this._checkIntersectionAndReport;
|
|
value = Reflect.apply(_checkIntersectionAndReport, this, [r1, value2, object2, a0, a1]);
|
|
value3 = true;
|
|
if (value) {
|
|
r11 = value3;
|
|
} else {
|
|
reducibleJoin5: while (true) {
|
|
if (r0) {
|
|
break reducibleJoin10;
|
|
}
|
|
r11 = r0;
|
|
break reducibleJoin5;
|
|
}
|
|
}
|
|
value = typeof r1 === 'bigint' ? r1 + 1n : +r1 + 1;
|
|
if (value < length) {
|
|
r0 = r11;
|
|
r1 = value;
|
|
continue reducibleLoop3;
|
|
}
|
|
break reducibleJoin10;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function _checkIntersectionAndReport(a0, a1, a2, a3, a4) { // fn#50920, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6650:4256, offset: 0x01225243, size: 187 bytes, params: 6, frame: 19
|
|
var r0;
|
|
this._setRelevantBounds(this._layouts[a0], a2);
|
|
if (this._itemIntersectsVisibleWindow(a2.start, a2.end)) {
|
|
if (a1) {
|
|
a3.splice(0, 0, a0);
|
|
a4.splice(0, 0, a0);
|
|
r0 = true;
|
|
} else {
|
|
a3.push(a0);
|
|
a4.push(a0);
|
|
r0 = true;
|
|
}
|
|
} else if (this._itemIntersectsEngagedWindow(a2.start, a2.end)) {
|
|
if (a1) {
|
|
a4.splice(0, 0, a0);
|
|
r0 = true;
|
|
} else {
|
|
a4.push(a0);
|
|
r0 = true;
|
|
}
|
|
} else {
|
|
r0 = false;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _updateTrackingWindows(a0, a1) { // fn#50928, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6650:5507, offset: 0x01225446, size: 152 bytes, params: 3, frame: 17
|
|
let value = a1.windowShift + a1.startCorrection;
|
|
const value2 = a1.windowShift + a1.endCorrection;
|
|
value = a0 + value;
|
|
const value3 = a0 + this._windowBound + value2;
|
|
const _engagedWindow = this._engagedWindow;
|
|
const Math = global.Math;
|
|
_engagedWindow.start = Math.max(0, value - this._renderAheadOffset);
|
|
this._engagedWindow.end = value3 + this._renderAheadOffset;
|
|
this._visibleWindow.start = value;
|
|
this._visibleWindow.end = value3;
|
|
}
|
|
|
|
function _diffArraysAndCallFunc(a0, a1, a2) { // fn#50930, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6650:6129, offset: 0x01225529, size: 98 bytes, params: 4, frame: 18
|
|
var value;
|
|
var value2;
|
|
var value5;
|
|
if (a2) {
|
|
value = this._calculateArrayDiff(a0, a1);
|
|
value2 = this._calculateArrayDiff(a1, a0);
|
|
if (value.length > 0 || value2.length > 0) {
|
|
value5 = environment.__proto__;
|
|
a2(env1_2([], a0, true), value, value2);
|
|
}
|
|
}
|
|
}
|
|
|
|
function _valueExtractorForBinarySearch(a0) { // fn#50900, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6650:431, owner: ViewabilityTracker._valueExtractorForBinarySearch, offset: 0x01224d5d, size: 51 bytes, params: 2, frame: 13
|
|
const binding = env0_0;
|
|
binding._setRelevantBounds(binding._layouts[a0], binding._relevantDim);
|
|
return binding._relevantDim.end;
|
|
}
|
|
|