Files
discord-decomp/sources/by-id/module-06403-RVLayoutManager.js
T
2026-07-28 01:06:53 +03:00

994 lines
36 KiB
JavaScript

/* Metro module 6403; source: unknown; dependencies: [6386, 6374, 6375, 6379, 6404, 6390, 6394, 6405] */
import ClassCallCheck from './module-06374-ClassCallCheck.js'; /* Metro dependency 6374 */
import CreateClass from './module-06375-CreateClass.js'; /* Metro dependency 6375 */
import Module06386 from './module-06386.js'; /* Metro dependency 6386 */
import * as Module06379Module from './module-06379.js'; /* Metro dependency 6379 */
import * as ConsecutiveNumbersModule from './module-06390-ConsecutiveNumbers.js'; /* Metro dependency 6390 */
import * as FindModule from './module-06404-find.js'; /* Metro dependency 6404 */
function _fun50175(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#50175, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6581:6, offset: 0x01212f0c, size: 120 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
exports.RVLayoutManager = _fun50176();
function _fun50176() { // fn#50176, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6581:132, offset: 0x01212f84, size: 437 bytes, params: 1, frame: 15
return CreateClass(RVLayoutManager, [{key: 'getEstimatedWidth', value: function(a0) {
return this.widthAverageWindow.getCurrentValue(this.getItemType(a0));
}}, {key: 'getEstimatedHeight', value: function(a0) {
return this.heightAverageWindow.getCurrentValue(this.getItemType(a0));
}}, {key: 'isHorizontal', value: function() {
return this.horizontal;
}}, {key: 'getWindowsSize', value: function() {
return this.windowSize;
}}, {key: 'getVisibleLayouts', value: value_50182}, {key: 'deleteLayout', value: value_50183}, {key: 'modifyLayout',
value: value_50185}, {key: 'getLayout', value: value_50186}, {key: 'updateLayoutParams', value: function(a0) {
this.windowSize = a0.windowSize;
this.horizontal = a0.horizontal ?? this.horizontal;
this.maxColumns = a0.maxColumns ?? this.maxColumns;
this.optimizeItemArrangement = a0.optimizeItemArrangement ?? this.optimizeItemArrangement;
}}, {key: 'getLayoutCount', value: function() {
return this.layouts.length;
}}, {key: 'getSpan', value: value_50189}, {key: 'handleSpanChange', value: function(a0) {
}}, {key: 'getMaxRecomputeIndex', value: function(a0) {
var Math = global.Math;
var Math2 = global.Math;
var value = Math2.max(a0, this.currentMaxIndexWithChangedLayout);
value += this.maxItemsToProcess;
return Math.min(value, this.layouts.length - 1);
}}, {key: 'getMinRecomputeIndex', value: function(a0) {
return a0;
}}, {key: '_recomputeLayouts', value: value_50193}, {key: 'computeEstimatesAndMinMaxChangedLayout',
value: value_50194}, {key: 'computeMinIndexWithChangedSpan', value: value_50195}]);
function RVLayoutManager(a0, a1) { // fn#50177, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6581:153, offset: 0x01213139, size: 339 bytes, params: 3, frame: 21
const value = environment.__proto__;
const binding = env1_3;
const value3 = undefined;
binding(this, RVLayoutManager);
this.requiresRepaint = false;
this.maxItemsToProcess = 250;
this.spanSizeInfo = {};
this.spanTracker = [];
this.currentMaxIndexWithChangedLayout = -1;
const Number = global.Number;
const MAX_VALUE = Number.MAX_VALUE;
this.lastSkippedLayoutIndex = MAX_VALUE;
const MultiTypeAverageWindow = (Module06379Module).MultiTypeAverageWindow;
this.heightAverageWindow = new MultiTypeAverageWindow(5, 200);
this.widthAverageWindow = new MultiTypeAverageWindow(5, 200);
const getItemType = a0.getItemType;
this.getItemType = getItemType;
this.overrideItemLayout = a0.overrideItemLayout;
this.layouts = (a1 == null ? value3 : a1.layouts) ?? [];
if (a1) {
this.updateLayoutParams(a0);
} else {
this.horizontal = global.Boolean(a0.horizontal);
this.windowSize = a0.windowSize;
this.maxColumns = a0.maxColumns ?? 1;
}
return value3;
}
function value_50182(a0, a1) { // fn#50182, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6581:1251, offset: 0x012132ea, size: 195 bytes, params: 3, frame: 21
const ConsecutiveNumbers = (ConsecutiveNumbersModule).ConsecutiveNumbers;
const value = environment.__proto__;
const firstVisibleIndex = FindModule.findFirstVisibleIndex(this.layouts, a0, this.horizontal);
const lastVisibleIndex = FindModule.findLastVisibleIndex(this.layouts, a1, this.horizontal);
return firstVisibleIndex === -1 ? ConsecutiveNumbers.EMPTY : lastVisibleIndex !== -1 ? new ConsecutiveNumbers(firstVisibleIndex,
lastVisibleIndex) : ConsecutiveNumbers.EMPTY;
}
function value_50183(a0) { // fn#50183, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6581:1533, offset: 0x012133ad, size: 153 bytes, params: 2, frame: 18
var environment;
var layouts;
var splice;
var error;
var Math;
var min;
var apply;
var value;
a0.sort(function(a0, a1) {
return a1 - a0;
});
const iterator = a0[Symbol.iterator]();
const iterator2 = iterator.next;
let r2 = iterator;
let item2 = Reflect.apply(iterator2, r2, []);
let item = item2.value;
item2 = item2.done ? undefined : r2;
reducibleJoin2: while (true) {
if (item2 === undefined) {
Math = global.Math;
min = Math.min;
apply = min.apply;
Math = global.Math;
value = environment.__proto__;
value = Reflect.apply(apply, min, [Math, env1_2(a0)]);
this._recomputeLayouts(this.getMinRecomputeIndex(value), this.getMaxRecomputeIndex(value));
return undefined;
}
break reducibleJoin2;
}
reducibleLoop2: while (true) {
try {
layouts = this.layouts;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
splice = layouts.splice;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
Reflect.apply(splice, layouts, [item, 1]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
r2 = item2;
item2 = Reflect.apply(iterator2, r2, []);
item = item2.value;
item2 = item2.done ? undefined : r2;
if (item2 === undefined) {
break reducibleLoop2;
}
continue reducibleLoop2;
}
Math = global.Math;
min = Math.min;
apply = min.apply;
Math = global.Math;
value = environment.__proto__;
value = Reflect.apply(apply, min, [Math, env1_2(a0)]);
const _recomputeLayouts = this._recomputeLayouts;
const minRecomputeIndex = this.getMinRecomputeIndex(value);
const getMaxRecomputeIndex = this.getMaxRecomputeIndex;
Reflect.apply(_recomputeLayouts, this, [minRecomputeIndex, Reflect.apply(getMaxRecomputeIndex, this, [value])]);
}
function value_50186(a0) { // fn#50186, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6581:2542, offset: 0x012135c6, size: 157 bytes, params: 2, frame: 13
var r0;
var object;
var Error;
var value;
var indexOutOfBounds;
if (a0 >= this.layouts.length) {
Error = global.Error;
value = environment.__proto__;
indexOutOfBounds = (require(6394) /* metro dependency 6394 */).ErrorMessages.indexOutOfBounds;
throw new Error();
}
const property = this.layouts[a0];
if (property) {
r0 = property;
} else {
object = {'x': 0, 'y': 0, 'width': 0, 'height': 0};
this.layouts[a0] = object;
r0 = object;
}
if (!(r0.isWidthMeasured && r0.isHeightMeasured)) {
this.estimateLayout(a0);
}
return r0;
}
function value_50194(a0) { // fn#50194, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6581:4317, offset: 0x01213874, size: 380 bytes, params: 2, frame: 27
var r15;
var r14;
var r13;
var r12;
var r11;
var index;
var dimensions;
var layouts;
var property;
var lastSkippedLayoutIndex;
var value2;
var value3;
var isHeightMeasured;
var value4;
var isWidthMeasured;
var value5;
var property2;
var moduleValue;
var areDimensionsNotEqual;
var height;
var height2;
var value6;
var property3;
var moduleValue2;
var width;
var width2;
var value7;
var Math;
var min;
var value8;
var max;
var currentMaxIndexWithChangedLayout;
var value9;
var heightAverageWindow;
var addValue;
var getItemType;
var value10;
var widthAverageWindow;
var value11;
var error;
const Number = global.Number;
const MAX_VALUE = Number.MAX_VALUE;
const iterator = a0[Symbol.iterator]();
const iterator2 = iterator.next;
let r0 = MAX_VALUE;
let r2 = iterator;
let item2 = Reflect.apply(iterator2, r2, []);
let item = item2.value;
item2 = item2.done ? undefined : r2;
reducibleJoin2: while (true) {
if (item2 === undefined) {
return r0;
}
break reducibleJoin2;
}
reducibleLoop2: while (true) {
try {
index = item.index;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
dimensions = item.dimensions;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
layouts = this.layouts;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
property = layouts[index];
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
lastSkippedLayoutIndex = this.lastSkippedLayoutIndex;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value2 = index >= lastSkippedLayoutIndex;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
reducibleJoin11: while (true) {
if (value2) {
r15 = value2;
break reducibleJoin11;
}
value3 = !property;
r15 = value3;
break reducibleJoin11;
}
reducibleJoin15: while (true) {
if (r15) {
r14 = r15;
break reducibleJoin15;
}
try {
isHeightMeasured = property.isHeightMeasured;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
value4 = !isHeightMeasured;
r14 = value4;
break reducibleJoin15;
}
reducibleJoin19: while (true) {
if (r14) {
r13 = r14;
break reducibleJoin19;
}
try {
isWidthMeasured = property.isWidthMeasured;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
value5 = !isWidthMeasured;
r13 = value5;
break reducibleJoin19;
}
reducibleJoin30: while (true) {
if (r13) {
r12 = r13;
break reducibleJoin30;
}
try {
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
property2 = dependencyMap[7];
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
moduleValue = require(property2);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
areDimensionsNotEqual = moduleValue.areDimensionsNotEqual;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
height = property.height;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
height2 = dimensions.height;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value6 = Reflect.apply(areDimensionsNotEqual, moduleValue, [height, height2]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
r12 = value6;
break reducibleJoin30;
}
reducibleJoin41: while (true) {
if (r12) {
r11 = r12;
break reducibleJoin41;
}
try {
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
property3 = dependencyMap[7];
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
moduleValue2 = require(property3);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
areDimensionsNotEqual = moduleValue2.areDimensionsNotEqual;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
width = property.width;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
width2 = dimensions.width;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value7 = Reflect.apply(areDimensionsNotEqual, moduleValue2, [width, width2]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
r11 = value7;
break reducibleJoin41;
}
reducibleJoin51: while (true) {
if (r11) {
try {
Math = global.Math;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
min = Math.min;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value8 = Reflect.apply(min, Math, [r0, index]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
Math = global.Math;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
max = Math.max;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
currentMaxIndexWithChangedLayout = this.currentMaxIndexWithChangedLayout;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value9 = Reflect.apply(max, Math, [currentMaxIndexWithChangedLayout, index]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
this.currentMaxIndexWithChangedLayout = value9;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
r0 = value8;
break reducibleJoin51;
}
break reducibleJoin51;
}
try {
heightAverageWindow = this.heightAverageWindow;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
addValue = heightAverageWindow.addValue;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
height = dimensions.height;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
getItemType = this.getItemType;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value10 = Reflect.apply(getItemType, this, [index]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
Reflect.apply(addValue, heightAverageWindow, [height, value10]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
widthAverageWindow = this.widthAverageWindow;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
addValue = widthAverageWindow.addValue;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
width = dimensions.width;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
getItemType = this.getItemType;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value11 = Reflect.apply(getItemType, this, [index]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
Reflect.apply(addValue, widthAverageWindow, [width, value11]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
r2 = item2;
item2 = Reflect.apply(iterator2, r2, []);
item = item2.value;
item2 = item2.done ? undefined : r2;
if (item2 === undefined) {
break reducibleLoop2;
}
continue reducibleLoop2;
}
return r0;
}
}
}
function value_50185(a0, a1) { // fn#50185, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6581:1777, offset: 0x01213446, size: 384 bytes, params: 3, frame: 23
var r6;
var r3;
var spanTracker;
var value;
var getLayout;
var getSpan;
var value2;
var recomputeLayouts;
var getMaxRecomputeIndex;
var value4;
var _recomputeLayouts;
let Math = global.Math;
const max = Math.max;
const maxItemsToProcess = this.maxItemsToProcess;
let length = a0.length;
this.maxItemsToProcess = Reflect.apply(max, Math, [maxItemsToProcess, 10 * length]);
const Number = global.Number;
const MAX_VALUE = Number.MAX_VALUE;
let layouts = this.layouts;
reducibleJoin2: while (true) {
if (layouts.length > a1) {
layouts = this.layouts;
layouts.length = a1;
spanTracker = this.spanTracker;
spanTracker.length = a1;
value = a1 - 1;
r6 = value;
break reducibleJoin2;
}
r6 = MAX_VALUE;
break reducibleJoin2;
}
Math = global.Math;
value = Math.min(r6, this.computeEstimatesAndMinMaxChangedLayout(a0));
length = this.layouts.length;
reducibleJoin7: while (true) {
if (length < a1) {
if (a1 > 0) {
layouts = this.layouts;
length = layouts.length;
layouts = this.layouts;
layouts.length = a1;
spanTracker = this.spanTracker;
spanTracker.length = a1;
if (length < a1) {
r3 = length;
reducibleLoop5: while (true) {
getLayout = this.getLayout;
Reflect.apply(getLayout, this, [r3]);
getSpan = this.getSpan;
Reflect.apply(getSpan, this, [r3]);
value2 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
if (value2 < a1) {
r3 = value2;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
recomputeLayouts = this.recomputeLayouts;
Reflect.apply(recomputeLayouts, this, [length, a1 - 1]);
break reducibleJoin7;
}
break reducibleJoin7;
}
break reducibleJoin7;
}
Math = global.Math;
value = Math.min(value, this.lastSkippedLayoutIndex, this.computeMinIndexWithChangedSpan(a0),
this.processLayoutInfo(a0, a1) ?? value, this.computeEstimatesAndMinMaxChangedLayout(a0));
reducibleJoin11: while (true) {
if (value >= 0) {
if (value < a1) {
getMaxRecomputeIndex = this.getMaxRecomputeIndex;
value4 = Reflect.apply(getMaxRecomputeIndex, this, [value]);
_recomputeLayouts = this._recomputeLayouts;
Reflect.apply(_recomputeLayouts, this, [value, value4]);
break reducibleJoin11;
}
break reducibleJoin11;
}
break reducibleJoin11;
}
this.currentMaxIndexWithChangedLayout = -1;
}
function value_50189(a0) { // fn#50189, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6581:3211, offset: 0x012136cd, size: 132 bytes, params: 2, frame: 17
let value = 1;
const r3 = arguments.length > value && arguments[value] !== undefined && arguments[value];
this.spanSizeInfo.span = undefined;
this.overrideItemLayout(a0, this.spanSizeInfo);
const Math = global.Math;
value = Math.min(this.spanSizeInfo.span ?? value, this.maxColumns);
if (!r3) {
this.spanTracker[a0] = value;
}
return value;
}
function value_50193(a0, a1) { // fn#50193, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6581:3829, offset: 0x0121379f, size: 213 bytes, params: 3, frame: 17
var Math;
var min;
var y;
this.recomputeLayouts(a0, a1);
if (this.lastSkippedLayoutIndex >= a0 && this.lastSkippedLayoutIndex <= a1) {
this.lastSkippedLayoutIndex = global.Number.MAX_VALUE;
}
value = a1 + 1;
let layouts = this.layouts;
if (value < layouts.length) {
Math = global.Math;
min = Math.min;
value = a1 + 1;
this.lastSkippedLayoutIndex = Reflect.apply(min, Math, [value, this.lastSkippedLayoutIndex]);
layouts = this.layouts;
value = layouts.length - 1;
layouts = this.layouts;
y = layouts[value].y;
layouts = this.layouts;
if (y < layouts[a1].y) {
this.recomputeLayouts(this.lastSkippedLayoutIndex, value);
this.lastSkippedLayoutIndex = global.Number.MAX_VALUE;
}
}
}
function value_50195(a0) { // fn#50195, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6581:4918, offset: 0x012139f0, size: 141 bytes, params: 2, frame: 22
var index;
var getSpan;
var value;
var spanTracker;
var property;
var value2;
var handleSpanChange;
var Math;
var min;
var error;
const Number = global.Number;
const MAX_VALUE = Number.MAX_VALUE;
const iterator = a0[Symbol.iterator]();
const iterator2 = iterator.next;
let r0 = MAX_VALUE;
let r2 = iterator;
let item2 = Reflect.apply(iterator2, r2, []);
let item = item2.value;
item2 = item2.done ? undefined : r2;
reducibleJoin2: while (true) {
if (item2 === undefined) {
return r0;
}
break reducibleJoin2;
}
reducibleLoop2: while (true) {
try {
index = item.index;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
getSpan = this.getSpan;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value = Reflect.apply(getSpan, this, [index, true]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
spanTracker = this.spanTracker;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
property = spanTracker[index];
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value2 = value === property;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
reducibleJoin19: while (true) {
if (value2) {
break reducibleJoin19;
}
try {
spanTracker = this.spanTracker;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
spanTracker[index] = value;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
handleSpanChange = this.handleSpanChange;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
Reflect.apply(handleSpanChange, this, [index]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
Math = global.Math;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
min = Math.min;
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
try {
value = Reflect.apply(min, Math, [r0, index]);
} catch (error) {
try {
item2.return();
} catch {
}
throw error;
}
r0 = value;
break reducibleJoin19;
}
r2 = item2;
item2 = Reflect.apply(iterator2, r2, []);
item = item2.value;
item2 = item2.done ? undefined : r2;
if (item2 === undefined) {
break reducibleLoop2;
}
continue reducibleLoop2;
}
return r0;
}
global.__d(_fun50175, 6403, [6386, 6374, 6375, 6379, 6404, 6390, 6394,
6405]) /* metro module 6403, dependencies: [6386, 6374, 6375, 6379, 6404, 6390, 6394, 6405] */;