Files
discord-decomp/sources/lib/PlainRecord.tsx
T
2026-07-28 01:06:53 +03:00

261 lines
11 KiB
TypeScript

/* Metro module 1419; source: lib/PlainRecord.tsx; dependencies: [1420, 44, 1421, 628, 2] */
import PlainRecord from '../external/discord_common/js/packages/libdiscore/js_shim/js/PlainRecord.tsx'; /* Metro dependency 1420 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as PlainRecordModule from '../external/discord_common/js/packages/libdiscore/js_shim/js/PlainRecord.tsx'; /* Metro dependency 1420 */
function _fun16575(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#16575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1546:6, offset: 0x00e53f8a, size: 238 bytes, params: 8, frame: 22
const env0_0 = require;
const closure = function(a0, a1) {
a1[TypeTag] = a0;
return a1;
};
let isValueEqual2 = isValueEqual;
const closure3 = function(a0, a1) {
var r3;
var isValueEqualBinding;
var property2;
var value4;
if (a0 !== a1) {
var property = global.Object;
var value = property.keys(a0);
var value2 = 0;
if (value2 < value.length) {
r3 = value2;
loopExit2: while (true) {
property = value[r3];
isValueEqualBinding = isValueEqual;
property2 = a0[property];
if (isValueEqualBinding(property2, a1[property])) {
value4 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
if (!(value4 < value.length)) {
return true;
}
r3 = value4;
continue;
}
break loopExit2;
}
return false;
}
}
return true;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const TypeTag = (PlainRecordModule).TypeTag;
(FileImportTrackerModule).fileFinishedImporting('lib/PlainRecord.tsx');
exports.default = PlainRecord;
exports.TypeTag = TypeTag;
exports.set = function(a0, a1, a2) {
var r0;
var object;
var value = a0;
var isValueEqualBinding = isValueEqual;
if (isValueEqualBinding(value[a1], a2)) {
r0 = value;
} else {
object = {};
copyDataProperties(object, value, isValueEqualBinding);
object[a1] = a2;
r0 = object;
}
return r0;
};
exports.merge = function(a0, a1) {
var r3;
var r8;
var r13;
var r12;
var r1;
var propertyName;
var propertyName2;
var property;
var property2;
var value4;
var isValueEqual2;
var object;
var value = a0;
var value2 = null;
var properties = Object.keys(a1);
var properties2 = 0;
var properties3 = properties.length;
if (properties === undefined) {
r1 = value2;
} else {
r3 = value2;
r8 = properties2;
while (true) {
propertyName = properties[r8];
propertyName2 = r8 + 1;
if (propertyName === undefined) {
r1 = r3;
break;
}
property = value[propertyName];
property2 = a1[propertyName];
value4 = property2 === undefined;
if (value4) {
r13 = value4;
continue;
}
isValueEqual2 = isValueEqual(property, property2);
r13 = isValueEqual2;
if (r13) {
r8 = propertyName2;
continue;
}
if (value2 == r3) {
object = {};
copyDataProperties(object, value, property);
object[propertyName] = property2;
r12 = object;
} else {
r3[propertyName] = property2;
r12 = r3;
}
r3 = r12;
r8 = propertyName2;
}
}
return value2 == r1 ? value : r1;
};
exports.tryReuseExistingInPlacePlainRecord = function(a0, a1, a2) {
var r0;
var value = a1;
var value2 = a2;
importDefault(dependencyMap[1])(value == null || value[TypeTag] === a0,
'Existing record type does not match the expected type');
if (value == null) {
constructInPlace(a0, value2);
r0 = value2;
} else if (isPlainRecordDataEqual(value, value2)) {
r0 = value;
} else {
constructInPlace(a0, value2);
r0 = value2;
}
return r0;
};
exports.objectIsPlainRecordOfType = objectIsPlainRecordOfType;
exports.constructInPlace = closure;
exports.copyConstruct = function(a0, a1) {
var r2;
var object = {};
copyDataProperties(object, a1, r2);
object[TypeTag] = a0;
return object;
};
exports.isValueEqual = isValueEqual2;
exports.isPlainRecordDataEqual = closure3;
function isValueEqual(a0, a1) { // fn#16577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1546:176, offset: 0x00e5408b, size: 300 bytes, params: 3, frame: 16
var r3;
var r0;
var value;
var Array;
if (a0 == null) {
r0 = a0 === a1;
} else if (a1 == null) {
r0 = a0 === a1;
} else {
value = a0 === a1;
if (value) {
r0 = value;
} else {
if (a0 instanceof global.Date) {
if (a1 instanceof global.Date) {
value = a0.getTime();
value = value === a1.getTime();
r3 = value;
} else if (a0 instanceof global.Set) {
if (a1 instanceof global.Set) {
value = require(1421) /* metro dependency 1421: SetUtils */;
value = value.areSetsEqual(a0, a1);
r3 = value;
} else {
Array = global.Array;
if (Array.isArray(a0)) {
Array = global.Array;
if (Array.isArray(a1)) {
value = require(628) /* metro dependency 628: shallowEqual */;
value = value.areArraysShallowEqual(a0, a1);
r3 = value;
} else {
r3 = typeof a0 === 'object' && typeof a1 === 'object';
r3 = r3 && (importDefault(628) /* metro dependency 628: shallowEqual */)(a0, a1);
}
} else {
r3 = typeof a0 === 'object' && typeof a1 === 'object';
r3 = r3 && (importDefault(628) /* metro dependency 628: shallowEqual */)(a0, a1);
}
}
} else {
Array = global.Array;
if (Array.isArray(a0)) {
Array = global.Array;
if (Array.isArray(a1)) {
value = require(628) /* metro dependency 628: shallowEqual */;
value = value.areArraysShallowEqual(a0, a1);
r3 = value;
} else {
r3 = typeof a0 === 'object' && typeof a1 === 'object';
r3 = r3 && (importDefault(628) /* metro dependency 628: shallowEqual */)(a0, a1);
}
} else {
r3 = typeof a0 === 'object' && typeof a1 === 'object';
r3 = r3 && (importDefault(628) /* metro dependency 628: shallowEqual */)(a0, a1);
}
}
} else if (a0 instanceof global.Set) {
if (a1 instanceof global.Set) {
value = require(1421) /* metro dependency 1421: SetUtils */;
value = value.areSetsEqual(a0, a1);
r3 = value;
} else {
Array = global.Array;
if (Array.isArray(a0)) {
Array = global.Array;
if (Array.isArray(a1)) {
value = require(628) /* metro dependency 628: shallowEqual */;
value = value.areArraysShallowEqual(a0, a1);
r3 = value;
} else {
r3 = typeof a0 === 'object' && typeof a1 === 'object';
r3 = r3 && (importDefault(628) /* metro dependency 628: shallowEqual */)(a0, a1);
}
} else {
r3 = typeof a0 === 'object' && typeof a1 === 'object';
r3 = r3 && (importDefault(628) /* metro dependency 628: shallowEqual */)(a0, a1);
}
}
} else {
Array = global.Array;
if (Array.isArray(a0)) {
Array = global.Array;
if (Array.isArray(a1)) {
value = require(628) /* metro dependency 628: shallowEqual */;
value = value.areArraysShallowEqual(a0, a1);
r3 = value;
} else {
r3 = typeof a0 === 'object' && typeof a1 === 'object';
r3 = r3 && (importDefault(628) /* metro dependency 628: shallowEqual */)(a0, a1);
}
} else {
r3 = typeof a0 === 'object' && typeof a1 === 'object';
r3 = r3 && (importDefault(628) /* metro dependency 628: shallowEqual */)(a0, a1);
}
}
r0 = r3;
}
}
return r0;
}
function objectIsPlainRecordOfType(a0, a1) { // fn#16582, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1546:1217, offset: 0x00e5432b, size: 57 bytes, params: 3, frame: 5
return typeof a1 === 'object' && a1 != null && (TypeTag in a1 && a1[TypeTag]) === a0;
}
}
global.__d(_fun16575, 1419, [1420, 44, 1421, 628,
2]) /* metro module 1419, dependencies: [1420, 44, 1421, 628, 2] */;