Files
discord-decomp/sources/modules/guild_templates/GuildTemplateStore.tsx
T
2026-07-27 16:20:00 +03:00

321 lines
13 KiB
TypeScript

/* Metro module 7069; source: modules/guild_templates/GuildTemplateStore.tsx; dependencies: [6, 7, 15, 17, 18, 6934, 6933, 566, 694, 2] */
function _fun56304(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#56304, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:6, offset: 0x013c4b60, size: 480 bytes, params: 8, frame: 22
const _arrayLikeToArray_56307 = 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) {
resolveGuildTemplate_56313(a0.guildTemplate);
};
const resolveGuildTemplate_56313 = function(a0) {
var env0_0 = a0;
updateGuildTemplate_56311(a0.code, _fun56314);
};
const closure2 = function(a0) {
updateGuildTemplate_56311(a0.code, _fun56316);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(15) /* metro dependency 15 */;
const env0_5 = importDefault(17) /* metro dependency 17 */;
const env0_6 = importDefault(18) /* metro dependency 18 */;
const env0_7 = (require(6934) /* metro dependency 6934: GuildTemplatesConstants */).GuildTemplateStates;
const Map = global.Map;
let map = new Map();
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
_fun56317(Store).displayName = 'GuildTemplateStore';
map = new map(importDefault(694) /* metro dependency 694: Dispatcher */,
{GUILD_TEMPLATE_RESOLVE: GUILD_TEMPLATE_RESOLVE, GUILD_TEMPLATE_CREATE_SUCCESS: closure,
GUILD_TEMPLATE_SYNC_SUCCESS: closure, GUILD_TEMPLATE_RESOLVE_SUCCESS: closure,
GUILD_TEMPLATE_LOAD_FOR_GUILD_SUCCESS: function({guildTemplates}) {
guildTemplates.forEach(_fun56325);
}, GUILD_TEMPLATE_RESOLVE_FAILURE: closure2, GUILD_TEMPLATE_DELETE_SUCCESS: closure2,
GUILD_TEMPLATE_ACCEPT: function(a0) {
updateGuildTemplate_56311(a0.code, _fun56327);
}, GUILD_TEMPLATE_ACCEPT_SUCCESS: function(a0) {
updateGuildTemplate_56311(a0.code, _fun56329);
}, GUILD_TEMPLATE_ACCEPT_FAILURE: function(a0) {
updateGuildTemplate_56311(a0.code, _fun56331);
}, GUILD_TEMPLATE_MODAL_SHOW: function(a0) {
env0_9 = a0.code;
}, GUILD_TEMPLATE_MODAL_HIDE: function() {
env0_9 = null;
}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_templates/GuildTemplateStore.tsx');
exports.default = map;
}
function _createForOfIteratorHelperLoose_56305(a0, a1) { // fn#56305, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:181, offset: 0x013c4d40, 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 _fun56306;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_56307(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_56307(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_56307(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun56306;
}
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 _isNativeReflectConstruct_56308() { // fn#56308, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:1091, offset: 0x013c4eb2, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_56308_isNativeReflectConstruct = function() {
return !!result;
})();
}
function updateGuildTemplate_56311(a0, a1) { // fn#56311, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:1305, offset: 0x013c4f10, size: 128 bytes, params: 3, frame: 15
var r2;
var binding;
var value2;
var object2;
var Map;
var value3;
var map;
if (a0 != null) {
binding = env0_8;
value2 = binding.get(a0);
if (value2 != null) {
object2 = {};
copyDataProperties(object2, value2, undefined);
r2 = object2;
} else {
r2 = {code: a0, state: GuildTemplateStates.RESOLVING};
}
a1(r2);
Map = global.Map;
binding = env0_8;
value3 = Object.create(Map.prototype, {constructor: {value: Map}});
map = new Map();
(map instanceof Object ? map : value3).set(a0, r2);
}
}
function resolveGuildTemplate_56313(a0) { // fn#56313, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:1524, offset: 0x013c4fa9, size: 36 bytes, params: 2, frame: 13
const env0_0 = a0;
updateGuildTemplate_56311(a0.code, _fun56314);
}
function GUILD_TEMPLATE_DELETE_SUCCESS({code}) { // fn#56315, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:1641, offset: 0x013c5018, size: 32 bytes, params: 2, frame: 13
updateGuildTemplate_56311(code, function(a0) {
a0.state = GuildTemplateStates.EXPIRED;
});
}
function _fun56317(a0) { // fn#56317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:1753, offset: 0x013c5052, size: 141 bytes, params: 2, frame: 16
const closure = GuildTemplateStore;
env0_6(closure, a0);
return env0_3(closure, [{key: 'getGuildTemplate', value: value_56319}, {key: 'getGuildTemplates',
value: value_56320}, {key: 'getForGuild', value: value_56321}, {key: 'getDisplayedGuildTemplateCode',
value: value_56322}]);
}
function GUILD_TEMPLATE_RESOLVE({code}) { // fn#56323, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:2553, offset: 0x013c5162, size: 82 bytes, params: 2, frame: 15
const Map = global.Map;
const map = new Map(env0_8);
const set = map.set;
const RESOLVING = GuildTemplateStates.RESOLVING;
Reflect.apply(set, map, [code, {code: code, state: RESOLVING}]);
}
function GUILD_TEMPLATE_LOAD_FOR_GUILD_SUCCESS({guildTemplates}) { // fn#56324, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:2878, offset: 0x013c51b4, size: 30 bytes, params: 2, frame: 11
guildTemplates.forEach(function(a0) {
resolveGuildTemplate_56313(a0);
});
}
function GUILD_TEMPLATE_ACCEPT({code}) { // fn#56326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:3138, offset: 0x013c51e5, size: 32 bytes, params: 2, frame: 13
updateGuildTemplate_56311(code, function(a0) {
a0.state = GuildTemplateStates.ACCEPTING;
});
}
function GUILD_TEMPLATE_ACCEPT_SUCCESS({code}) { // fn#56328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:3269, offset: 0x013c5205, size: 32 bytes, params: 2, frame: 13
updateGuildTemplate_56311(code, _fun56329);
}
function GUILD_TEMPLATE_ACCEPT_FAILURE({code}) { // fn#56330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:3456, offset: 0x013c5260, size: 32 bytes, params: 2, frame: 13
updateGuildTemplate_56311(code, function(a0) {
a0.state = GuildTemplateStates.RESOLVED;
});
}
function _fun56314(a0) { // fn#56314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:1592, offset: 0x013c4fcd, size: 75 bytes, params: 2, frame: 18
var propertyName;
let value = environment.__proto__;
value = importDefault(6933) /* metro dependency 6933: createResolvedGuildTemplate */;
value = value(env0_0);
for (propertyName in value) {
a0[propertyName] = value[propertyName];
}
}
function value_56321(a0) { // fn#56321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:2198, offset: 0x013c50df, size: 131 bytes, params: 2, frame: 18
var r3;
var value5;
var get;
var value6;
var sourceGuildId;
var state;
var EXPIRED;
var value7;
const _createForOfIteratorHelperLoose_56305Binding = _createForOfIteratorHelperLoose_56305;
let binding = env1_8;
const value3 = _createForOfIteratorHelperLoose_56305Binding(binding.keys());
const value4 = value3();
let done = value4.done;
if (!done) {
r3 = value4;
reducibleLoop1: while (true) {
value5 = r3.value;
binding = env1_8;
get = binding.get;
value6 = Reflect.apply(get, binding, [value5]);
if (value6 != null) {
reducibleJoin5: while (true) {
if ('sourceGuildId' in value6) {
sourceGuildId = value6.sourceGuildId;
if (sourceGuildId !== a0) {
break reducibleJoin5;
}
state = value6.state;
EXPIRED = GuildTemplateStates.EXPIRED;
if (state !== EXPIRED) {
return value6;
}
break reducibleJoin5;
}
break reducibleJoin5;
}
}
value7 = value3();
done = value7.done;
if (done) {
return undefined;
}
r3 = value7;
continue reducibleLoop1;
}
}
}
function _fun56329(a0) { // fn#56329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7247:3349, offset: 0x013c5225, size: 59 bytes, params: 2, frame: 4
const value = environment.__proto__;
const ACCEPTED = GuildTemplateStates.ACCEPTED;
a0.state = ACCEPTED;
a0.usageCount = (a0.usageCount ?? 0) + 1;
}