328 lines
11 KiB
TypeScript
328 lines
11 KiB
TypeScript
/* Metro module 1942; source: utils/GuildRoleRecordUtils.tsx; dependencies: [1419, 1939, 483, 673, 1941, 2] */
|
|
function _fun21569(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#21569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2069:6, offset: 0x00ef3e63, size: 269 bytes, params: 8, frame: 22
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_21572 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const closure = function(a0, a1) {
|
|
var r2;
|
|
var value4;
|
|
var id;
|
|
var value5;
|
|
var object = {};
|
|
var value2 = _createForOfIteratorHelperLoose_21570(a1);
|
|
var value3 = value2();
|
|
if (!value3.done) {
|
|
for (r2 = value3; true; r2 = value5) {
|
|
value4 = r2.value;
|
|
id = value4.id;
|
|
object[id] = fromServer_21574(a0, value4);
|
|
value5 = value2();
|
|
if (value5.done) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return object;
|
|
};
|
|
const closure2 = fromServer_21574;
|
|
const closure3 = function(a0) {
|
|
return constructInPlace(GuildRoleRecordTypeTag, a0);
|
|
};
|
|
const closure4 = fromSerialized;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const plainRecordModule = require(1419) /* metro dependency 1419: PlainRecord */;
|
|
const env0_3 = plainRecordModule.constructInPlace;
|
|
const env0_4 = plainRecordModule.objectIsPlainRecordOfType;
|
|
const env0_5 = (require(1939) /* metro dependency 1939: GuildRoleRecord */).GuildRoleRecordTypeTag;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('utils/GuildRoleRecordUtils.tsx');
|
|
exports.isGuildRoleRecord = function(a0) {
|
|
return objectIsPlainRecordOfType(GuildRoleRecordTypeTag, a0);
|
|
};
|
|
exports.fromServerArray = closure;
|
|
exports.fromServer = closure2;
|
|
exports.constructGuildRoleInPlace = closure3;
|
|
exports.fromSerialized = closure4;
|
|
exports.fromSyncOperation = fromSyncOperation;
|
|
exports.fromSerializedPartition = function(a0, a1) {
|
|
var propertyName;
|
|
var object = {};
|
|
for (propertyName in a1) {
|
|
object[propertyName] = fromSerialized(a0, a1[propertyName]);
|
|
}
|
|
return object;
|
|
};
|
|
exports.toSerializedPartition = function(a0) {
|
|
var r11;
|
|
var propertyName;
|
|
var property;
|
|
var object2;
|
|
var object = {};
|
|
for (propertyName in a0) {
|
|
property = a0[propertyName];
|
|
object2 = {};
|
|
copyDataProperties(object2, property, r11);
|
|
property = property.permissions;
|
|
object2['permissions'] = property.toString();
|
|
object[propertyName] = object2;
|
|
r11 = property;
|
|
}
|
|
return object;
|
|
};
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_21570(a0, a1) { // fn#21570, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2069:196, offset: 0x00ef3f70, size: 370 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun21571;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_21572(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_21572(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_21572(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun21571;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
}
|
|
|
|
function fromServer_21574(a0, a1) { // fn#21574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2069:1251, offset: 0x00ef412d, size: 371 bytes, params: 3, frame: 19
|
|
var r6;
|
|
var moduleValue2;
|
|
var value;
|
|
const constructGuildRoleInPlaceBinding = constructGuildRoleInPlace;
|
|
const object2 = {};
|
|
object2.id = a1.id;
|
|
object2.name = a1.name;
|
|
object2.guildId = a0;
|
|
const bigFlagUtilsModule = importAll(483) /* metro dependency 483: BigFlagUtils */;
|
|
object2.permissions = bigFlagUtilsModule.deserialize(a1.permissions);
|
|
object2.mentionable = a1.mentionable;
|
|
object2.position = a1.position;
|
|
let color = a1.color;
|
|
object2.color = color;
|
|
color = a1.color;
|
|
const value2 = null;
|
|
const value3 = 0;
|
|
if (value3 === color) {
|
|
r6 = value2;
|
|
} else {
|
|
moduleValue2 = require(673) /* metro dependency 673: ColorUtils */;
|
|
r6 = moduleValue2.int2hex(a1.color);
|
|
}
|
|
object2.colorString = r6;
|
|
const colors = a1.colors;
|
|
object2.colors = value2 != colors ? colors : value2;
|
|
if (value2 != a1.colors) {
|
|
value = require(1941) /* metro dependency 1941: EnhancedRoleColorUtils */;
|
|
value = value.extractColorStringsFromServerColors(a1.colors);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value2;
|
|
}
|
|
object2.colorStrings = r6;
|
|
object2.hoist = a1.hoist;
|
|
const managed = a1.managed;
|
|
object2.managed = value2 != managed && managed;
|
|
const tags = a1.tags;
|
|
object2.tags = value2 != tags ? tags : {};
|
|
object2.icon = a1.icon;
|
|
object2.unicodeEmoji = a1.unicode_emoji;
|
|
const flags = a1.flags;
|
|
object2.flags = value2 != flags ? flags : value3;
|
|
const description = a1.description;
|
|
object2.description = value2 != description ? description : value2;
|
|
object2.version = a1.version;
|
|
return constructGuildRoleInPlaceBinding(object2);
|
|
}
|
|
|
|
function fromSerialized(a0, a1) { // fn#21576, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2069:1894, offset: 0x00ef42b8, size: 385 bytes, params: 3, frame: 18
|
|
var r5;
|
|
var moduleValue2;
|
|
var value;
|
|
const constructGuildRoleInPlaceBinding = constructGuildRoleInPlace;
|
|
const object2 = {};
|
|
object2.id = a1.id;
|
|
object2.name = a1.name;
|
|
object2.guildId = a0;
|
|
const bigFlagUtilsModule = importAll(483) /* metro dependency 483: BigFlagUtils */;
|
|
object2.permissions = bigFlagUtilsModule.deserialize(a1.permissions);
|
|
object2.mentionable = a1.mentionable;
|
|
object2.position = a1.position;
|
|
let color = a1.color;
|
|
object2.color = color;
|
|
color = a1.color;
|
|
const value2 = null;
|
|
if (value2 != color) {
|
|
if (a1.color === 0) {
|
|
r5 = value2;
|
|
} else {
|
|
moduleValue2 = require(673) /* metro dependency 673: ColorUtils */;
|
|
r5 = moduleValue2.int2hex(a1.color);
|
|
}
|
|
} else {
|
|
r5 = value2;
|
|
}
|
|
object2.colorString = r5;
|
|
const colors = a1.colors;
|
|
object2.colors = value2 != colors ? colors : value2;
|
|
if (value2 != a1.colors) {
|
|
value = require(1941) /* metro dependency 1941: EnhancedRoleColorUtils */;
|
|
value = value.extractColorStringsFromServerColors(a1.colors);
|
|
r5 = value;
|
|
} else {
|
|
r5 = value2;
|
|
}
|
|
object2.colorStrings = r5;
|
|
object2.hoist = a1.hoist;
|
|
const managed = a1.managed;
|
|
object2.managed = value2 != managed && managed;
|
|
const tags = a1.tags;
|
|
object2.tags = value2 != tags ? tags : {};
|
|
object2.icon = a1.icon;
|
|
object2.unicodeEmoji = a1.unicodeEmoji;
|
|
const flags = a1.flags;
|
|
object2.flags = value2 != flags ? flags : 0;
|
|
const description = a1.description;
|
|
object2.description = value2 != description ? description : value2;
|
|
object2.version = a1.version;
|
|
return constructGuildRoleInPlaceBinding(object2);
|
|
}
|
|
|
|
function fromSyncOperation(a0, a1, a2) { // fn#21578, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:2069:2803, offset: 0x00ef4451, size: 183 bytes, params: 4, frame: 19
|
|
var r4;
|
|
var value4;
|
|
var value5;
|
|
var value8;
|
|
var id;
|
|
var value9;
|
|
if (a1.op === 'full_sync') {
|
|
return fromServerArray(a0, a1.items);
|
|
}
|
|
const object2 = {};
|
|
copyDataProperties(object2, a2, undefined);
|
|
const value2 = _createForOfIteratorHelperLoose_21570(a1.deletes);
|
|
const value3 = value2();
|
|
let done = value3.done;
|
|
if (!done) {
|
|
r4 = value3;
|
|
reducibleLoop2: while (true) {
|
|
value4 = r4.value;
|
|
delete object2[value4];
|
|
value5 = value2();
|
|
done = value5.done;
|
|
if (done) {
|
|
break reducibleLoop2;
|
|
}
|
|
r4 = value5;
|
|
continue reducibleLoop2;
|
|
}
|
|
}
|
|
const value6 = _createForOfIteratorHelperLoose_21570(a1.writes);
|
|
const value7 = value6();
|
|
done = value7.done;
|
|
if (!done) {
|
|
r4 = value7;
|
|
reducibleLoop4: while (true) {
|
|
value8 = r4.value;
|
|
id = value8.id;
|
|
object2[id] = fromServer_21574(a0, value8);
|
|
value9 = value6();
|
|
done = value9.done;
|
|
if (done) {
|
|
break reducibleLoop4;
|
|
}
|
|
r4 = value9;
|
|
continue reducibleLoop4;
|
|
}
|
|
}
|
|
return object2;
|
|
}
|
|
|