343 lines
17 KiB
TypeScript
343 lines
17 KiB
TypeScript
/* Metro module 7167; source: modules/application_commands/ApplicationCommandAutocompleteStore.tsx; dependencies: [6, 7, 15, 17, 18, 7168, 661, 477, 1909, 4863, 566, 694, 2] */
|
|
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import ApplicationCommandStore from './ApplicationCommandStore.tsx'; /* Metro dependency 7168 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as PlatformUtilsModule from '../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as AppAnalyticsUtilsModule from '../app_analytics/AppAnalyticsUtils.tsx'; /* Metro dependency 4863 */
|
|
|
|
function _fun57523(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:6, offset: 0x013e7d30, size: 508 bytes, params: 8, frame: 22
|
|
const env0_0 = require;
|
|
const CONNECTION_OPEN_575282 = CONNECTION_OPEN_57528;
|
|
const APPLICATION_COMMAND_SET_ACTIVE_COMMAND2 = APPLICATION_COMMAND_SET_ACTIVE_COMMAND;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let Map = global.Map;
|
|
let map = new Map();
|
|
Map = global.Map;
|
|
map = new Map();
|
|
Map = global.Map;
|
|
map = new Map();
|
|
const env0_12 = (PlatformUtilsModule).isDesktop();
|
|
const Store = (Flux).Store;
|
|
_fun57531(Store).displayName = 'ApplicationCommandAutocompleteStore';
|
|
map = new map(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: CONNECTION_OPEN_575282,
|
|
LOGOUT: CONNECTION_OPEN_575282, CHANNEL_SELECT: CONNECTION_OPEN_575282,
|
|
APPLICATION_COMMAND_AUTOCOMPLETE_REQUEST: APPLICATION_COMMAND_AUTOCOMPLETE_REQUEST,
|
|
APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE: APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE,
|
|
INTERACTION_FAILURE: INTERACTION_FAILURE_57541,
|
|
APPLICATION_COMMAND_SET_ACTIVE_COMMAND: APPLICATION_COMMAND_SET_ACTIVE_COMMAND2,
|
|
APP_LAUNCHER_SET_ACTIVE_COMMAND: APPLICATION_COMMAND_SET_ACTIVE_COMMAND2,
|
|
APPLICATION_COMMAND_UPDATE_CHANNEL_STATE: APPLICATION_COMMAND_UPDATE_CHANNEL_STATE});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/application_commands/ApplicationCommandAutocompleteStore.tsx');
|
|
exports.default = map;
|
|
function _isNativeReflectConstruct_57524() { // fn#57524, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:183, offset: 0x013e7f2c, 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_57524_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function getOrCreateChannelState(a0) { // fn#57527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:410, offset: 0x013e7f8a, size: 255 bytes, params: 2, frame: 18
|
|
var set;
|
|
var object;
|
|
var activeCommand;
|
|
var value3;
|
|
var Map;
|
|
var prototype;
|
|
var value4;
|
|
var map;
|
|
var value6;
|
|
var value8;
|
|
var value10;
|
|
let binding = env0_10;
|
|
if (!binding.has(a0)) {
|
|
binding = env0_10;
|
|
set = binding.set;
|
|
object = {};
|
|
activeCommand = ApplicationCommandStore.getActiveCommand(a0);
|
|
value3 = undefined;
|
|
object.commandId = activeCommand == null ? value3 : activeCommand.id;
|
|
object.optionName = ApplicationCommandStore.getActiveOptionName(a0);
|
|
Map = global.Map;
|
|
prototype = Map.prototype;
|
|
value4 = Object.create(prototype, {constructor: {value: Map}});
|
|
map = new Map();
|
|
object.optionNameToAutocompleteQueries = map instanceof Object ? map : value4;
|
|
Map = global.Map;
|
|
prototype = Map.prototype;
|
|
value6 = Object.create(prototype, {constructor: {value: Map}});
|
|
map = new Map();
|
|
object.optionNameToLastResults = map instanceof Object ? map : value6;
|
|
Map = global.Map;
|
|
prototype = Map.prototype;
|
|
value8 = Object.create(prototype, {constructor: {value: Map}});
|
|
map = new Map();
|
|
object.optionNameToNonce = map instanceof Object ? map : value8;
|
|
Map = global.Map;
|
|
prototype = Map.prototype;
|
|
value10 = Object.create(prototype, {constructor: {value: Map}});
|
|
map = new Map();
|
|
object.optionNameToLastQuery = map instanceof Object ? map : value10;
|
|
object.lastErrored = false;
|
|
object.lastResponseNonce = value3;
|
|
Reflect.apply(set, binding, [a0, object]);
|
|
}
|
|
return env0_10.get(a0);
|
|
}
|
|
|
|
function CHANNEL_SELECT_57528() { // fn#57528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:747, offset: 0x013e8089, size: 35 bytes, params: 1, frame: 10
|
|
env0_9.clear();
|
|
env0_10.clear();
|
|
return true;
|
|
}
|
|
|
|
function APPLICATION_COMMAND_SET_ACTIVE_COMMAND({channelId, command}) { // fn#57529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:825, offset: 0x013e80ac, size: 47 bytes, params: 2, frame: 15
|
|
handleCommandChange(channelId, command?.id);
|
|
}
|
|
|
|
function handleCommandChange(a0, a1) { // fn#57530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:925, offset: 0x013e80db, size: 184 bytes, params: 3, frame: 15
|
|
const activeOptionName = ApplicationCommandStore.getActiveOptionName(a0);
|
|
let value = env0_10.get(a0);
|
|
let r0 = value != null && (a1 !== value.commandId || activeOptionName !== value.optionName);
|
|
if (r0) {
|
|
if (a1 != null && a1 !== value.commandId) {
|
|
value.optionNameToLastResults.clear();
|
|
value.optionNameToNonce.clear();
|
|
value.optionNameToLastQuery.clear();
|
|
value.optionNameToAutocompleteQueries.clear();
|
|
}
|
|
value.lastErrored = false;
|
|
value.commandId = a1;
|
|
value.optionName = activeOptionName;
|
|
value = true;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun57531(a0) { // fn#57531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:1275, offset: 0x013e8193, size: 164 bytes, params: 2, frame: 16
|
|
const ApplicationCommandAutocompleteStore2 = ApplicationCommandAutocompleteStore;
|
|
Inherits(ApplicationCommandAutocompleteStore2, a0);
|
|
return CreateClass(ApplicationCommandAutocompleteStore2, [{key: 'initialize', value: function() {
|
|
this.waitFor(ApplicationCommandStore);
|
|
}}, {key: 'getLastErrored', value: function(a0) {
|
|
return getOrCreateChannelState(a0).lastErrored;
|
|
}}, {key: 'getAutocompleteChoices', value: value_57535}, {key: 'getAutocompleteLastChoices', value: function(a0,
|
|
a1) {
|
|
return getOrCreateChannelState(a0).optionNameToLastResults.get(a1);
|
|
}}, {key: 'getLastResponseNonce', value: function(a0) {
|
|
return getOrCreateChannelState(a0).lastResponseNonce;
|
|
}}]);
|
|
function ApplicationCommandAutocompleteStore() { // fn#57532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:1287, offset: 0x00ea76ec, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_2(this, ApplicationCommandAutocompleteStore);
|
|
const value3 = env1_5(ApplicationCommandAutocompleteStore);
|
|
return env1_4(this, _isNativeReflectConstruct_57524() ? global.Reflect.construct(value3, arguments,
|
|
env1_5(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_57535(a0, a1, a2) { // fn#57535, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:1833, offset: 0x013e8250, size: 60 bytes, params: 4, frame: 12
|
|
let value = environment.__proto__;
|
|
const getOrCreateChannelStateBinding = getOrCreateChannelState;
|
|
value = undefined;
|
|
const value2 = getOrCreateChannelStateBinding(a0).optionNameToAutocompleteQueries.get(a1);
|
|
return value2 == null ? value : value2.get(a2);
|
|
}
|
|
|
|
}
|
|
|
|
function APPLICATION_COMMAND_AUTOCOMPLETE_REQUEST({nonce, channelId, query, name}) { // fn#57538, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:2382, offset: 0x013e82cb, size: 303 bytes, params: 2, frame: 20
|
|
var r1;
|
|
const orCreateChannelState = getOrCreateChannelState(channelId);
|
|
let optionNameToLastQuery = orCreateChannelState.optionNameToLastQuery;
|
|
const get = optionNameToLastQuery.get;
|
|
if (Reflect.apply(get, optionNameToLastQuery, [name]) === query) {
|
|
return false;
|
|
}
|
|
optionNameToLastQuery = orCreateChannelState.optionNameToLastQuery;
|
|
let set = optionNameToLastQuery.set;
|
|
Reflect.apply(set, optionNameToLastQuery, [name, query]);
|
|
const r2 = orCreateChannelState.optionNameToAutocompleteQueries.get(name)?.get(query);
|
|
if (r2 != null) {
|
|
orCreateChannelState.lastErrored = false;
|
|
orCreateChannelState.optionNameToLastResults.set(name, r2);
|
|
return true;
|
|
}
|
|
const value6 = orCreateChannelState.optionNameToNonce.get(name);
|
|
if (value6 != null) {
|
|
env0_9.delete(value6);
|
|
}
|
|
let binding = env0_9;
|
|
binding.set(nonce, {channelId: channelId, query: query, name: name});
|
|
binding = env0_11;
|
|
set = binding.set;
|
|
const Date = global.Date;
|
|
Reflect.apply(set, binding, [nonce, new Date()]);
|
|
orCreateChannelState.optionNameToNonce.set(name, nonce);
|
|
if (orCreateChannelState.lastErrored) {
|
|
orCreateChannelState.lastErrored = false;
|
|
r1 = true;
|
|
} else {
|
|
r1 = undefined;
|
|
}
|
|
return r1;
|
|
}
|
|
|
|
function APPLICATION_COMMAND_AUTOCOMPLETE_RESPONSE({choices, nonce}) { // fn#57539, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:2966, offset: 0x013e83fa, size: 534 bytes, params: 2, frame: 22
|
|
var r5;
|
|
var r3;
|
|
var set;
|
|
var Map;
|
|
var value5;
|
|
var map;
|
|
var applicationCommandStoreBinding;
|
|
var value7;
|
|
var Date;
|
|
var value12;
|
|
var date;
|
|
var optionNameToLastResults;
|
|
let value = undefined;
|
|
let binding = env0_9;
|
|
let get = binding.get;
|
|
const value3 = Reflect.apply(get, binding, [nonce]);
|
|
if (value3 == null) {
|
|
return false;
|
|
}
|
|
env0_9.delete(nonce);
|
|
const orCreateChannelState = getOrCreateChannelState(value3.channelId);
|
|
let optionNameToAutocompleteQueries = orCreateChannelState.optionNameToAutocompleteQueries;
|
|
get = optionNameToAutocompleteQueries.get;
|
|
let name = value3.name;
|
|
if (Reflect.apply(get, optionNameToAutocompleteQueries, [name]) == null) {
|
|
optionNameToAutocompleteQueries = orCreateChannelState.optionNameToAutocompleteQueries;
|
|
set = optionNameToAutocompleteQueries.set;
|
|
name = value3.name;
|
|
Map = global.Map;
|
|
value5 = Object.create(Map.prototype, {constructor: {value: Map}});
|
|
map = new Map();
|
|
Reflect.apply(set, optionNameToAutocompleteQueries, [name, map instanceof Object ? map : value5]);
|
|
}
|
|
binding = env0_12;
|
|
if (binding) {
|
|
applicationCommandStoreBinding = ApplicationCommandStore;
|
|
value7 = applicationCommandStoreBinding.getActiveOption(value3.channelId);
|
|
r5 = (value7 == null ? value : value7.type) === (require(1909) /* metro dependency 1909: Server */).ApplicationCommandOptionType.INTEGER;
|
|
} else {
|
|
r5 = binding;
|
|
}
|
|
r5 = choices == null ? value : choices.map(_fun57540);
|
|
r5 = r5 ?? [];
|
|
const value10 = env0_11.get(nonce);
|
|
if (value10 != null) {
|
|
Date = global.Date;
|
|
value12 = Object.create(Date.prototype, {constructor: {value: Date}});
|
|
date = new Date();
|
|
r3 = (date instanceof Object ? date : value12).getTime() - value10.getTime();
|
|
} else {
|
|
r3 = 0;
|
|
}
|
|
value = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
|
|
const trackWithMetadata = value.trackWithMetadata;
|
|
const APPLICATION_COMMAND_OPTION_STRING_AUTOCOMPLETE_PERFORMANCE = AnalyticEvents.APPLICATION_COMMAND_OPTION_STRING_AUTOCOMPLETE_PERFORMANCE;
|
|
Reflect.apply(trackWithMetadata, value, [APPLICATION_COMMAND_OPTION_STRING_AUTOCOMPLETE_PERFORMANCE,
|
|
{duration_ms: r3, error: false, num_options: r5.length}]);
|
|
env0_11.delete(nonce);
|
|
value = orCreateChannelState.optionNameToAutocompleteQueries.get(value3.name);
|
|
if (value != null) {
|
|
value.set(value3.query, r5);
|
|
}
|
|
const optionNameToLastQuery = orCreateChannelState.optionNameToLastQuery;
|
|
get = optionNameToLastQuery.get;
|
|
if (Reflect.apply(get, optionNameToLastQuery, [value3.name]) === value3.query) {
|
|
orCreateChannelState.lastErrored = false;
|
|
optionNameToLastResults = orCreateChannelState.optionNameToLastResults;
|
|
optionNameToLastResults.set(value3.name, r5);
|
|
}
|
|
orCreateChannelState.lastResponseNonce = nonce;
|
|
return true;
|
|
function _fun57540({value, name_localized, name}) { // fn#57540, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:3390, offset: 0x013e8610, size: 75 bytes, params: 2, frame: 14
|
|
var r1;
|
|
const object = {};
|
|
object.displayName = name_localized ?? name;
|
|
object.name = name;
|
|
if (env0_0) {
|
|
value = global.Number(value);
|
|
r1 = value;
|
|
} else {
|
|
r1 = value;
|
|
}
|
|
object.value = r1;
|
|
return object;
|
|
}
|
|
|
|
}
|
|
|
|
function INTERACTION_FAILURE_57541({nonce}) { // fn#57541, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:3927, offset: 0x013e865b, size: 232 bytes, params: 2, frame: 19
|
|
var r0;
|
|
var Date;
|
|
var value5;
|
|
var date;
|
|
if (nonce == null) {
|
|
return false;
|
|
}
|
|
const value2 = env0_9.get(nonce);
|
|
if (value2 == null) {
|
|
return false;
|
|
}
|
|
env0_9.delete(nonce);
|
|
const value3 = env0_11.get(nonce);
|
|
if (value3 != null) {
|
|
Date = global.Date;
|
|
value5 = Object.create(Date.prototype, {constructor: {value: Date}});
|
|
date = new Date();
|
|
r0 = (date instanceof Object ? date : value5).getTime() - value3.getTime();
|
|
} else {
|
|
r0 = 0;
|
|
}
|
|
const trackWithMetadata = AppAnalyticsUtilsModule.trackWithMetadata;
|
|
const APPLICATION_COMMAND_OPTION_STRING_AUTOCOMPLETE_PERFORMANCE = AnalyticEvents.APPLICATION_COMMAND_OPTION_STRING_AUTOCOMPLETE_PERFORMANCE;
|
|
Reflect.apply(trackWithMetadata, AppAnalyticsUtilsModule,
|
|
[APPLICATION_COMMAND_OPTION_STRING_AUTOCOMPLETE_PERFORMANCE, {duration_ms: r0, error: true}]);
|
|
env0_11.delete(nonce);
|
|
getOrCreateChannelState(value2.channelId).lastErrored = true;
|
|
return true;
|
|
}
|
|
|
|
function APPLICATION_COMMAND_UPDATE_CHANNEL_STATE({channelId, command}) { // fn#57542, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7345:4445, offset: 0x013e80ac, size: 47 bytes, params: 2, frame: 15
|
|
handleCommandChange(channelId, command?.id);
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun57523, 7167, [6, 7, 15, 17, 18, 7168, 661, 477, 1909, 4863, 566, 694,
|
|
2]) /* metro module 7167, dependencies: [6, 7, 15, 17, 18, 7168, 661, 477, 1909, 4863, 566, 694, 2] */;
|