Files
discord-decomp/sources/modules/search/managers/SearchTabsFetchManager.tsx
T
2026-07-28 01:06:53 +03:00

184 lines
11 KiB
TypeScript

/* Metro module 9683; source: modules/search/managers/SearchTabsFetchManager.tsx; dependencies: [29, 6, 7, 15, 17, 18, 9615, 661, 9684, 9685, 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 ObjectWithoutProperties from '../../../by-id/module-00029-ObjectWithoutProperties.js'; /* Metro dependency 29 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as SearchConstantsModule from '../SearchConstants.tsx'; /* Metro dependency 9615 */
import * as SearchFetcherModule from '../SearchFetcher.tsx'; /* Metro dependency 9684 */
import * as AbstractSearchFetchManagerModule from './AbstractSearchFetchManager.tsx'; /* Metro dependency 9685 */
function _fun76089(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#76089, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9869:6, offset: 0x01dc3a9c, size: 354 bytes, params: 8, frame: 19
const env0_0 = require;
const env0_2 = ['include_nsfw', 'channel_id'];
const env0_3 = ['has'];
const env0_4 = ['has'];
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = SearchConstantsModule;
const env0_11 = value.SEARCH_FILTERS_BY_TAB;
const env0_12 = value.SEARCH_QUERY_BY_SEARCH_FILTER;
const env0_13 = value.SEARCH_QUERY_DEFAULT_FILTERS;
const AbstractSearchFetchManager = (AbstractSearchFetchManagerModule).AbstractSearchFetchManager;
value = _fun76093(AbstractSearchFetchManager);
value = new value();
(FileImportTrackerModule).fileFinishedImporting('modules/search/managers/SearchTabsFetchManager.tsx');
exports.default = value;
function _isNativeReflectConstruct_76090() { // fn#76090, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9869:339, offset: 0x01dc3bfe, size: 98 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_76090_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun76093(a0) { // fn#76093, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9869:538, offset: 0x01dc3c60, size: 126 bytes, params: 2, frame: 16
const SearchTabsFetchManager2 = SearchTabsFetchManager;
Inherits(SearchTabsFetchManager2, a0);
return CreateClass(SearchTabsFetchManager2, [{key: 'createRequestPayload', value: value_76095},
{key: 'createWithPayload', value: value_76097}, {key: 'create', value: function({id, searchContext, searchQuery,
searchTabs, getLimit, pagination, trackExactTotalHits}) {
this.cancel(id);
var withPayload = this.createWithPayload({searchContext: searchContext, searchQuery: searchQuery,
searchTabs: searchTabs, getLimit: getLimit, pagination: pagination,
trackExactTotalHits: trackExactTotalHits});
this.set(id, withPayload);
return withPayload;
}}]);
function SearchTabsFetchManager() { // fn#76094, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9869:550, offset: 0x01dc3cde, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_6(this, SearchTabsFetchManager);
const value3 = env1_9(SearchTabsFetchManager);
return env1_8(this, _isNativeReflectConstruct_76090() ? global.Reflect.construct(value3, arguments,
env1_9(this).constructor) : value3.apply(this, arguments));
}
function value_76095({searchQuery, searchTabs, getLimit, pagination, trackExactTotalHits}) { // fn#76095, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9869:888, offset: 0x01dc3d4f, size: 126 bytes, params: 2, frame: 18
const include_nsfw = searchQuery.include_nsfw;
const channel_id = searchQuery.channel_id;
const env0_2 = env1_5(searchQuery, env1_2);
const object = {include_nsfw: include_nsfw, channel_ids: channel_id, tabs: {},
track_exact_total_hits: trackExactTotalHits};
searchTabs.forEach(_fun76096);
return object;
function _fun76096(a0) { // fn#76096, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9869:1102, offset: 0x01dc3dcd, size: 276 bytes, params: 2, frame: 23
const limit = getLimit(a0);
const property = SEARCH_FILTERS_BY_TAB[a0];
const r6 = property != null ? SEARCH_QUERY_BY_SEARCH_FILTER[property] : {};
const has = r6.has;
const binding = env2_5;
const value4 = binding(r6, env2_3);
const binding2 = env0_2;
const has2 = binding2.has;
const value5 = binding(binding2, env2_4);
const Set = global.Set;
const r2 = has ?? [];
let items2 = [];
arraySpread(items2, has2 ?? [], arraySpread(items2, r2, 0, null), null);
const set = new Set(items2);
items2 = [];
arraySpread(items2, set, 0, null);
const tabs = env0_3.tabs;
const object = {};
copyDataProperties(object, SEARCH_QUERY_DEFAULT_FILTERS, 0);
copyDataProperties(object, value4, 0);
copyDataProperties(object, value5, 0);
copyDataProperties(object, items2.length > 0 ? {has: items2} : {}, 0);
copyDataProperties(object, pagination, 0);
object['limit'] = limit;
tabs[a0] = object;
}
}
function value_76097({searchContext, searchQuery, searchTabs, getLimit, pagination, trackExactTotalHits}) { // fn#76097, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9869:1329, offset: 0x01dc3ee1, size: 427 bytes, params: 2, frame: 21
const SearchTabFetcherImpl = (SearchFetcherModule).SearchTabFetcherImpl;
var type2;
var value4;
var searchTabFetcherImpl;
var channelId;
var value5;
var guildId;
var value6;
let value = this.createRequestPayload({searchQuery: searchQuery, searchTabs: searchTabs, getLimit: getLimit,
pagination: pagination, trackExactTotalHits: trackExactTotalHits});
let type = searchContext.type;
const GUILD = SearchTypes.GUILD;
if (GUILD === type) {
guildId = searchContext.guildId;
type = searchContext.type;
value6 = Object.create(SearchTabFetcherImpl.prototype, {constructor: {value: SearchTabFetcherImpl}});
searchTabFetcherImpl = new SearchTabFetcherImpl(guildId, type, searchQuery, value);
return searchTabFetcherImpl instanceof Object ? searchTabFetcherImpl : value6;
}
const GUILD_CHANNEL = SearchTypes.GUILD_CHANNEL;
if (GUILD_CHANNEL === type) {
guildId = searchContext.guildId;
type = searchContext.type;
value6 = Object.create(SearchTabFetcherImpl.prototype, {constructor: {value: SearchTabFetcherImpl}});
searchTabFetcherImpl = new SearchTabFetcherImpl(guildId, type, searchQuery, value);
return searchTabFetcherImpl instanceof Object ? searchTabFetcherImpl : value6;
}
const THREAD = SearchTypes.THREAD;
if (THREAD === type) {
guildId = searchContext.guildId;
type = searchContext.type;
value6 = Object.create(SearchTabFetcherImpl.prototype, {constructor: {value: SearchTabFetcherImpl}});
searchTabFetcherImpl = new SearchTabFetcherImpl(guildId, type, searchQuery, value);
return searchTabFetcherImpl instanceof Object ? searchTabFetcherImpl : value6;
}
const CHANNEL = SearchTypes.CHANNEL;
if (CHANNEL === type) {
channelId = searchContext.channelId;
type = searchContext.type;
value5 = Object.create(SearchTabFetcherImpl.prototype, {constructor: {value: SearchTabFetcherImpl}});
searchTabFetcherImpl = new SearchTabFetcherImpl(channelId, type, searchQuery, value);
return searchTabFetcherImpl instanceof Object ? searchTabFetcherImpl : value5;
}
const DMS = SearchTypes.DMS;
if (DMS === type) {
type = searchContext.type;
type2 = searchContext.type;
value4 = Object.create(SearchTabFetcherImpl.prototype, {constructor: {value: SearchTabFetcherImpl}});
searchTabFetcherImpl = new SearchTabFetcherImpl(type, type2, searchQuery, value);
return searchTabFetcherImpl instanceof Object ? searchTabFetcherImpl : value4;
}
const Error = global.Error;
value = '[SearchFetchManager] Unsupported search context type: ' + searchContext.type;
const value3 = Object.create(Error.prototype, {constructor: {value: Error}});
const error = new Error(value);
throw error instanceof Object ? error : value3;
}
}
}
global.__d(_fun76089, 9683, [29, 6, 7, 15, 17, 18, 9615, 661, 9684, 9685,
2]) /* metro module 9683, dependencies: [29, 6, 7, 15, 17, 18, 9615, 661, 9684, 9685, 2] */;