Files
discord-decomp/sources/modules/application_commands/ApplicationCommandIndexActionCreators.tsx
2026-07-28 01:06:53 +03:00

217 lines
12 KiB
TypeScript

/* Metro module 7865; source: modules/application_commands/ApplicationCommandIndexActionCreators.tsx; dependencies: [5, 661, 694, 507, 672, 683, 1360, 2] */
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
import Dispatcher from '../../Dispatcher.tsx'; /* Metro dependency 694 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as GlobalUtilsModule from '../../utils/GlobalUtils.tsx'; /* Metro dependency 1360 */
function _fun62942(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#62942, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:6, offset: 0x01b6ca89, size: 177 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/application_commands/ApplicationCommandIndexActionCreators.tsx');
exports.fetchApplicationCommandIndex = function() {
return _fetchApplicationCommandIndex.apply(this, arguments);
};
exports.requestApplicationCommandIndex = requestApplicationCommandIndex;
function _fetchApplicationCommandIndex() { // fn#62943, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:149, offset: 0x01b6cb3a, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun62945).apply(this, arguments);
function* _fun62945(a0, a1) { // fn#62945, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:230, offset: 0x01b6cb73, size: 286 bytes, params: 3, frame: 15
var environment;
var binding;
var APPLICATION_COMMAND_INDEX_USER;
if (true) {
var env0_0 = a0;
var env0_1 = a1;
var env0_2;
var env0_3;
var env0_5;
var env0_6;
env0_3 = global.performance.now();
env0_5 = [];
var type = a0.type;
if (type === 'channel') {
value = environment.__proto__.__proto__;
binding = env2_5;
env0_2 = binding.APPLICATION_COMMAND_INDEX_CHANNEL(a0.channelId);
} else if (type === 'guild') {
value = environment.__proto__.__proto__;
binding = env2_5;
env0_2 = binding.APPLICATION_COMMAND_INDEX_GUILD(a0.guildId);
} else if (type === 'user') {
value = environment.__proto__.__proto__;
APPLICATION_COMMAND_INDEX_USER = env2_5.APPLICATION_COMMAND_INDEX_USER;
} else if (type === 'application') {
value = environment.__proto__.__proto__;
binding = env2_5;
env0_2 = binding.APPLICATION_COMMAND_INDEX_APPLICATION(a0.applicationId);
}
env0_6 = _fun62946();
yield fetch_62951();
}
function _fun62946() { // fn#62946, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:566, offset: 0x01b6cc91, size: 32 bytes, params: 1, frame: 12
const env0_0 = env3_3(_fun62948);
return _fun62950;
function* _fun62948(a0) { // fn#62948, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:586, offset: 0x01b6ccba, size: 190 bytes, params: 2, frame: 15
var environment;
var binding;
var value7;
if (false) {
return undefined;
}
const env0_0 = a0;
value = environment.__proto__.__proto__;
if (env2_4 >= 3) {
binding = env2_5;
binding.push(1002);
binding = env2_8;
binding({error: true});
value7 = environment.__proto__.__proto__.__proto__.__proto__.__proto__;
binding = env5_1;
return binding(env5_2[2]).dispatch({type: 'APPLICATION_COMMAND_INDEX_FETCH_FAILURE', target: env2_0});
}
const Promise = global.Promise;
const value3 = Object.create(Promise.prototype, {constructor: {value: Promise}});
const promise = new Promise(_fun62949);
yield promise instanceof Object ? promise : value3;
if (false) {
return undefined;
}
return env2_7();
function _fun62949(a0) { // fn#62949, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:738, offset: 0x00fc555a, size: 28 bytes, params: 2, frame: 13
return global.setTimeout(a0, env0_0);
}
}
function _fun62950() { // fn#62950, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:778, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13
return env0_0.apply(this, arguments);
}
}
function fetch_62951() { // fn#62951, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:830, offset: 0x01b6cd78, size: 129 bytes, params: 1, frame: 16
var environment;
const value = environment.__proto__.__proto__.__proto__;
const HTTP = env3_0(env3_2[3]).HTTP;
const get = HTTP.get;
return Reflect.apply(get, HTTP, [{url: APPLICATION_COMMAND_INDEX_USER, retries: 3 - ConstantsModule.AnalyticEvents - 1,
signal: require.signal, onRequestCreated: onRequestCreated_62952, rejectWithError: false}]).then(_fun62953,
_fun62954);
function fetch_62951OnRequestCreated() { // fn#62952, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:905, owner: fetch_62951.onRequestCreated, offset: 0x01b6cdf9, size: 19 bytes, params: 1, frame: 3
const binding = env1_4;
const value2 = typeof binding === 'bigint' ? binding : +binding;
env1_4 = typeof value2 === 'bigint' ? value2 + 1n : +value2 + 1;
return value2;
}
function _fun62953(a0) { // fn#62953, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:940, offset: 0x01b6ce0c, size: 138 bytes, params: 2, frame: 15
var r0;
var value;
var value2;
if (a0.status === 202) {
value = environment.__proto__;
env1_5.push(202);
value = env1_6(5000);
r0 = value;
} else {
value = environment.__proto__;
end_62955({error: false});
value2 = environment.__proto__.__proto__.__proto__.__proto__;
value = env4_1(env4_2[2]).dispatch({type: 'APPLICATION_COMMAND_INDEX_FETCH_SUCCESS', target: env1_0,
index: a0.body});
r0 = value;
}
return r0;
}
function _fun62954(a0) { // fn#62954, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:1088, offset: 0x01b6ce96, size: 275 bytes, params: 2, frame: 16
var r0;
var binding;
var push;
var end_62955Binding;
var value3;
var retry_after;
let value = environment.__proto__;
if (require.signal.aborted) {
env1_5.push(1001);
end_62955Binding = end_62955;
value = undefined;
end_62955Binding({error: true});
r0 = value;
} else if (a0.status === 429) {
binding = env1_5;
binding.push(429);
binding = env1_6;
retry_after = a0.body.retry_after;
value = environment.__proto__.__proto__.__proto__.__proto__;
value = binding(retry_after * env4_1(env4_2[4]).Millis.SECOND);
r0 = value;
} else {
binding = env1_5;
push = binding.push;
r0 = a0.status ?? 1000;
Reflect.apply(push, binding, [r0]);
end_62955({error: true});
value3 = environment.__proto__.__proto__.__proto__.__proto__;
binding = env4_1;
r0 = binding(env4_2[2]).dispatch({type: 'APPLICATION_COMMAND_INDEX_FETCH_FAILURE', target: env1_0});
}
return r0;
}
}
function end_62955({error}) { // fn#62955, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:1365, offset: 0x01b6cfa9, size: 216 bytes, params: 2, frame: 20
let value = global.performance.now();
value -= env0_3;
let binding = env3_1;
const value4 = binding(env3_2[5]);
const track = value4.track;
const APPLICATION_COMMAND_PERFORMANCE = env3_4.APPLICATION_COMMAND_PERFORMANCE;
const object = {duration_ms: value, error: error};
object.aborted = require.signal.aborted;
object.include_applications = true;
const Math = global.Math;
object.retries = Math.max(ConstantsModule.AnalyticEvents - 1, 0);
object.kind = null;
object.command_type = null;
object.url = APPLICATION_COMMAND_INDEX_USER;
binding = env0_0;
object.target_type = binding.type;
object.target_id = env3_7(binding);
object.failure_statuses = env0_5;
Reflect.apply(track, value4, [APPLICATION_COMMAND_PERFORMANCE, object]);
}
}
}
function getTargetId(a0) { // fn#62956, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:1718, offset: 0x01b6d081, size: 103 bytes, params: 2, frame: 12
const type = a0.type;
if (type === 'channel') {
return a0.channelId;
}
if (type === 'guild') {
return a0.guildId;
}
if (type === 'user') {
return null;
}
if (type === 'application') {
return a0.applicationId;
}
(GlobalUtilsModule).assertNever(a0);
}
function requestApplicationCommandIndex(a0) { // fn#62958, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8043:2183, offset: 0x01b6d0e8, size: 57 bytes, params: 2, frame: 13
(Dispatcher).dispatch({type: 'APPLICATION_COMMAND_INDEX_FETCH_REQUEST',
target: a0});
}
}
global.__d(_fun62942, 7865, [5, 661, 694, 507, 672, 683, 1360,
2]) /* metro module 7865, dependencies: [5, 661, 694, 507, 672, 683, 1360, 2] */;