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

485 lines
23 KiB
JavaScript

/* Metro module 310; source: unknown; dependencies: [57, 6, 7, 44] */
import ClassCallCheck from './module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from './module-00007-CreateClass.js'; /* Metro dependency 7 */
import Module00057 from './module-00057.js'; /* Metro dependency 57 */
import * as Module00044Module from './module-00044.js'; /* Metro dependency 44 */
function _fun4756(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#4756, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:351:6, offset: 0x00ccc5db, size: 129 bytes, params: 8, frame: 18
const env0_0 = require;
const _isViewable = function(a0, a1, a2, a3, a4, a5) {
var r1;
if (a2 >= 0 && a3 <= a4 && a3 > a2) {
return true;
}
var Math = global.Math;
value = Math.min(a3, a4);
Math = global.Math;
value -= Math.max(a2, 0);
Math = global.Math;
value = Math.max(0, value);
if (a0) {
value /= a4;
r1 = value;
} else {
value /= a5;
r1 = value;
}
return 100 * r1 >= a1;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
exports.default = _fun4758();
function _fun4758() { // fn#4758, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:351:128, offset: 0x00ccc6dc, size: 170 bytes, params: 1, frame: 15
return CreateClass(ViewabilityHelper, [{key: 'dispose', value: function() {
this._timers.forEach(global.clearTimeout);
}}, {key: 'computeViewableItems', value: value_4761}, {key: 'onUpdate', value: value_4762},
{key: 'resetViewableIndices', value: function() {
this._viewableIndices = [];
}}, {key: 'recordInteraction', value: function() {
this._hasInteracted = true;
}}, {key: '_onUpdateSync', value: value_4767}]);
function ViewabilityHelper() { // fn#4759, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:351:149, offset: 0x00ccc786, size: 149 bytes, params: 1, frame: 15
const r1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {viewAreaCoveragePercentThreshold: 0};
const value = environment.__proto__;
env1_3(this, ViewabilityHelper);
this._hasInteracted = false;
const Set = global.Set;
this._timers = new Set();
this._viewableIndices = [];
const Map = global.Map;
this._viewableItems = new Map();
this._config = r1;
}
function value_4761(a0, a1, a2, a3, a4) { // fn#4761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:351:528, offset: 0x00ccc83a, size: 446 bytes, params: 6, frame: 38
var r1;
var r4;
var r8;
var r18;
var value6;
var value7;
var getCellMetrics;
var Math;
var floor;
var offset;
var value8;
var length;
var value9;
var _isViewableBinding;
var push;
var console;
var warn;
var JSON;
let value = a4;
const itemCount = a0.getItemCount(a0.data);
const {itemVisiblePercentThreshold, viewAreaCoveragePercentThreshold} = this._config;
const value3 = viewAreaCoveragePercentThreshold != null;
const r12 = value3 ? viewAreaCoveragePercentThreshold : itemVisiblePercentThreshold;
const value5 = r12 != null;
reducibleJoin3: while (true) {
if (value5) {
value6 = itemVisiblePercentThreshold != null;
value7 = value6 !== (viewAreaCoveragePercentThreshold != null);
r1 = value7;
break reducibleJoin3;
}
r1 = value5;
break reducibleJoin3;
}
Module00044Module(r1, 'Must set exactly one of itemVisiblePercentThreshold or viewAreaCoveragePercentThreshold');
const items2 = [];
if (itemCount !== 0) {
reducibleJoin6: while (true) {
if (value) {
r1 = value;
break reducibleJoin6;
}
r1 = {first: 0, last: itemCount - 1};
break reducibleJoin6;
}
var first = r1.first;
var last = r1.last;
if (last >= itemCount) {
console = global.console;
warn = console.warn;
JSON = global.JSON;
value = JSON.stringify({renderRange: value, itemCount: itemCount});
Reflect.apply(warn, console, ['Invalid render range computing viewability ' + value]);
return [];
}
value = -1;
if (first <= last) {
r4 = value;
r8 = first;
reducibleLoop8: while (true) {
getCellMetrics = a3.getCellMetrics;
value = Reflect.apply(getCellMetrics, a3, [r8, a0]);
if (value) {
Math = global.Math;
floor = Math.floor;
offset = value.offset;
value8 = Reflect.apply(floor, Math, [offset - a1]);
Math = global.Math;
floor = Math.floor;
length = value.length;
value9 = Reflect.apply(floor, Math, [value8 + length]);
reducibleJoin14: while (true) {
reducibleJoin15: while (true) {
if (value8 < a2) {
if (value9 > 0) {
_isViewableBinding = _isViewable;
length = value.length;
if (_isViewableBinding(value3, r12, value8, value9, a2, length)) {
push = items2.push;
Reflect.apply(push, items2, [r8]);
r18 = r8;
break reducibleJoin14;
}
r18 = r8;
break reducibleJoin14;
}
if (r4 >= 0) {
break reducibleJoin15;
}
r18 = r4;
break reducibleJoin14;
}
if (r4 >= 0) {
break reducibleJoin15;
}
r18 = r4;
break reducibleJoin14;
}
return items2;
}
} else {
r18 = r4;
}
value = typeof r8 === 'bigint' ? r8 + 1n : +r8 + 1;
if (value <= last) {
r4 = r18;
r8 = value;
continue reducibleLoop8;
}
break reducibleLoop8;
}
}
}
return items2;
}
function value_4762(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#4762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:351:1250, offset: 0x00ccc9f8, size: 299 bytes, params: 8, frame: 23
var r3;
var _viewableIndices;
const itemCount = global.getItemCount(global.data);
if (this._config.waitForInteraction) {
if (this._hasInteracted) {
if (itemCount !== 0) {
if (importAll.getCellMetrics(0, global)) {
r3 = itemCount ? this.computeViewableItems(global, require, importDefault, importAll,
dependencyMap) : [];
_viewableIndices = this._viewableIndices;
if (_viewableIndices.length !== r3.length) {
this._viewableIndices = r3;
if (this._config.minimumViewTime) {
this._timers.add(global.setTimeout(_fun4764, this._config.minimumViewTime));
} else {
this._onUpdateSync(global, r3, exports, module);
}
} else {
_viewableIndices = this._viewableIndices;
if (!_viewableIndices.every(_fun4763)) {
this._viewableIndices = r3;
if (this._config.minimumViewTime) {
this._timers.add(global.setTimeout(_fun4764, this._config.minimumViewTime));
} else {
this._onUpdateSync(global, r3, exports, module);
}
}
}
}
}
}
} else if (itemCount !== 0) {
if (importAll.getCellMetrics(0, global)) {
r3 = itemCount ? this.computeViewableItems(global, require, importDefault, importAll, dependencyMap) : [];
_viewableIndices = this._viewableIndices;
if (_viewableIndices.length !== r3.length) {
this._viewableIndices = r3;
if (this._config.minimumViewTime) {
this._timers.add(global.setTimeout(_fun4764, this._config.minimumViewTime));
} else {
this._onUpdateSync(global, r3, exports, module);
}
} else {
_viewableIndices = this._viewableIndices;
if (!_viewableIndices.every(_fun4763)) {
this._viewableIndices = r3;
if (this._config.minimumViewTime) {
this._timers.add(global.setTimeout(_fun4764, this._config.minimumViewTime));
} else {
this._onUpdateSync(global, r3, exports, module);
}
}
}
}
}
function _fun4763(a0, a1) { // fn#4763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:351:1536, offset: 0x00cccb23, size: 23 bytes, params: 3, frame: 2
return a0 === CreateClass[a1];
}
function _fun4764() { // fn#4764, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:351:1644, offset: 0x00cccb3a, size: 60 bytes, params: 1, frame: 17
ClassCallCheck._timers.delete(env0_5);
ClassCallCheck._onUpdateSync(env0_0, CreateClass, Module00057, env0_1);
}
}
function value_4767(a0, a1, a2, a3) { // fn#4767, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:351:1993, offset: 0x00cccb96, size: 380 bytes, params: 5, frame: 30
var environment;
var r8;
var r7;
var filter;
var value;
var _viewableItems;
var Map;
var map;
var prototype;
var value2;
var items2;
var iterator;
var iterator2;
var value3;
var item;
var item2;
var binding;
var value4;
var property;
var property2;
var has;
var value5;
var push;
var error;
var iterator3;
var item3;
var value6;
var property3;
var value7;
var Object;
var assign;
var object;
var object2;
var value8;
var length;
var Array;
var from;
var values;
var _config;
exceptionSkip35: while (true) {
exceptionLanding35: while (true) {
exceptionSkip14: while (true) {
exceptionLanding14: while (true) {
var env0_0 = a0;
var env0_1 = a3;
var env0_2 = this;
filter = a1.filter;
value = Reflect.apply(filter, a1, [_fun4768]);
_viewableItems = this._viewableItems;
Map = global.Map;
map = value.map;
value = Reflect.apply(map, value, [_fun4769]);
prototype = Map.prototype;
value2 = Object.create(prototype, {constructor: {value: Map}});
map = new Map();
value = map instanceof Object ? map : value2;
items2 = [];
iterator = value[Symbol.iterator]();
iterator2 = iterator.next;
value3 = environment.__proto__;
r8 = iterator;
while (true) {
item2 = Reflect.apply(iterator2, r8, []);
item = item2.value;
item2 = item2.done ? undefined : r8;
if (item2 === undefined) {
break;
}
try {
binding = env1_2;
} catch (error) {
break exceptionLanding14;
}
try {
value4 = binding(item, 2);
} catch (error) {
break exceptionLanding14;
}
try {
property = value4[0];
} catch (error) {
break exceptionLanding14;
}
try {
property2 = value4[1];
} catch (error) {
break exceptionLanding14;
}
try {
has = _viewableItems.has;
} catch (error) {
break exceptionLanding14;
}
try {
value5 = Reflect.apply(has, _viewableItems, [property]);
} catch (error) {
break exceptionLanding14;
}
if (value5) {
r8 = item2;
continue;
}
try {
push = items2.push;
} catch (error) {
break exceptionLanding14;
}
try {
Reflect.apply(push, items2, [property2]);
} catch (error) {
break exceptionLanding14;
}
r8 = item2;
}
iterator = _viewableItems[Symbol.iterator]();
iterator3 = iterator.next;
r7 = iterator;
while (true) {
item3 = Reflect.apply(iterator3, r7, []);
item = item3.value;
item3 = item3.done ? undefined : r7;
if (item3 === undefined) {
break;
}
try {
binding = env1_2;
} catch (error) {
break exceptionLanding35;
}
try {
value6 = binding(item, 2);
} catch (error) {
break exceptionLanding35;
}
try {
property = value6[0];
} catch (error) {
break exceptionLanding35;
}
try {
property3 = value6[1];
} catch (error) {
break exceptionLanding35;
}
try {
has = value.has;
} catch (error) {
break exceptionLanding35;
}
try {
value7 = Reflect.apply(has, value, [property]);
} catch (error) {
break exceptionLanding35;
}
if (value7) {
r7 = item3;
continue;
}
try {
push = items2.push;
} catch (error) {
break exceptionLanding35;
}
try {
Object = global.Object;
} catch (error) {
break exceptionLanding35;
}
try {
assign = Object.assign;
} catch (error) {
break exceptionLanding35;
}
try {
object = {};
} catch (error) {
break exceptionLanding35;
}
try {
object.isViewable = false;
} catch (error) {
break exceptionLanding35;
}
try {
object2 = {};
} catch (error) {
break exceptionLanding35;
}
try {
value8 = Reflect.apply(assign, Object, [object2, property3, object]);
} catch (error) {
break exceptionLanding35;
}
try {
Reflect.apply(push, items2, [value8]);
} catch (error) {
break exceptionLanding35;
}
r7 = item3;
}
length = items2.length;
if (length > 0) {
this._viewableItems = value;
Array = global.Array;
from = Array.from;
values = value.values;
_config = this._config;
a2({viewableItems: Reflect.apply(from, Array, [Reflect.apply(values, value, [])]),
changed: items2,
viewabilityConfig: _config});
}
return undefined;
break exceptionSkip14;
}
try {
item2.return();
} catch {
}
throw error;
break exceptionSkip14;
}
break exceptionSkip35;
}
try {
item3.return();
} catch {
}
throw error;
break exceptionSkip35;
}
function _fun4768(a0) { // fn#4768, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:351:2048, offset: 0x00cccd12, size: 28 bytes, params: 2, frame: 11
return env0_2._viewableIndices.includes(a0);
}
function _fun4769(a0) { // fn#4769, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:351:2144, offset: 0x00cccd2e, size: 44 bytes, params: 2, frame: 15
const moduleValue = importAll(a0, true, env0_0);
return [moduleValue.key, moduleValue];
}
}
}
}
global.__d(_fun4756, 310, [57, 6, 7, 44]) /* metro module 310, dependencies: [57, 6, 7, 44] */;