234 lines
10 KiB
TypeScript
234 lines
10 KiB
TypeScript
/* Metro module 6608; source: modules/guild_onboarding/useFlattenedChannels.tsx; dependencies: [1379, 22, 1360, 566, 2] */
|
|
import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */
|
|
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as GlobalUtilsModule from '../../utils/GlobalUtils.tsx'; /* Metro dependency 1360 */
|
|
|
|
function _fun52143(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#52143, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6786:6, offset: 0x013202ef, size: 151 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_52146 = 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 getFlattenedChannels2 = getFlattenedChannels;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/guild_onboarding/useFlattenedChannels.tsx');
|
|
exports.getFlattenedChannels = getFlattenedChannels2;
|
|
exports.useFlattenedChannels = useFlattenedChannels;
|
|
function _createForOfIteratorHelperLoose_52144(a0, a1) { // fn#52144, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6786:110, offset: 0x01320386, 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 _fun52145;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_52146(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_52146(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_52146(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun52145;
|
|
}
|
|
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 _fun52145() { // fn#52145, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6786:681, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
|
|
return env0_1 >= env0_0.length ? {done: true} : {done: false,
|
|
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
|
|
}
|
|
|
|
}
|
|
|
|
function getFlattenedChannels(a0, a1, a2) { // fn#52147, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6786:1020, offset: 0x013204f8, size: 410 bytes, params: 4, frame: 21
|
|
var r0;
|
|
var r2;
|
|
var value21;
|
|
var value22;
|
|
let value = a3;
|
|
const env0_0 = a1;
|
|
const env0_1 = a2;
|
|
reducibleJoin2: while (true) {
|
|
if (value !== undefined) {
|
|
r0 = value;
|
|
break reducibleJoin2;
|
|
}
|
|
value = false;
|
|
r0 = value;
|
|
break reducibleJoin2;
|
|
}
|
|
const defaultImport = Module00022;
|
|
const channelStoreBinding = ChannelStore;
|
|
const getMutableGuildChannelsForGuild = channelStoreBinding.getMutableGuildChannelsForGuild;
|
|
const env0_3 = defaultImport(Reflect.apply(getMutableGuildChannelsForGuild, channelStoreBinding,
|
|
[a0])).values().groupBy('parent_id').value();
|
|
const value7 = defaultImport(a2).map(function(a0) {
|
|
return a0.isCategory() ? a0.id : a0.parent_id;
|
|
});
|
|
const filter = value7.filter;
|
|
const isNotNullish = (GlobalUtilsModule).isNotNullish;
|
|
const value14 = Reflect.apply(filter, value7, [isNotNullish]).uniq().map(function(a0) {
|
|
return ChannelStore.getChannel(a0);
|
|
}).filter(isNotNullish).sortBy('position').value();
|
|
const Set = global.Set;
|
|
const set = new Set(value14.map(function(a0) {
|
|
return a0.id;
|
|
}));
|
|
const value19 = defaultImport.sortBy(a2.filter(_fun52151), function(a0) {
|
|
var value = a0.isGuildVocal();
|
|
var position = a0.position;
|
|
return value ? position + 10000 : position;
|
|
});
|
|
const getFlattenedChannels_loop2 = getFlattenedChannels_loop;
|
|
value = _createForOfIteratorHelperLoose_52144(value14);
|
|
const value20 = value();
|
|
let done = value20.done;
|
|
if (!done) {
|
|
r2 = value20;
|
|
reducibleLoop3: while (true) {
|
|
value21 = r2.value;
|
|
getFlattenedChannels_loop2(value21);
|
|
value22 = value();
|
|
done = value22.done;
|
|
if (done) {
|
|
break reducibleLoop3;
|
|
}
|
|
r2 = value22;
|
|
continue reducibleLoop3;
|
|
}
|
|
}
|
|
return value19;
|
|
function _fun52151(a0) { // fn#52151, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6786:1367, offset: 0x013206c7, size: 62 bytes, params: 2, frame: 13
|
|
return !(a0.isCategory() || a0.parent_id != null && env0_4.has(a0.parent_id));
|
|
}
|
|
|
|
function getFlattenedChannels_loop(a0) { // fn#52153, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6786:1513, owner: getFlattenedChannels._loop, offset: 0x0132072b, size: 178 bytes, params: 2, frame: 17
|
|
const env0_0 = a0;
|
|
if (!env0_2) {
|
|
env0_5.push(a0);
|
|
}
|
|
let r5 = require.has(a0.id) ? env0_3[a0.id] : importDefault.filter(_fun52154);
|
|
const defaultImport = Module00022;
|
|
const sortBy = defaultImport.sortBy;
|
|
r5 = r5 ?? [];
|
|
const value4 = Reflect.apply(sortBy, defaultImport, [r5, function(a0) {
|
|
var value = a0.isGuildVocal();
|
|
var position = a0.position;
|
|
return value ? position + 10000 : position;
|
|
}]);
|
|
const binding = env0_5;
|
|
const push = binding.push;
|
|
const items2 = [];
|
|
arraySpread(items2, value4, 0, null);
|
|
apply(push, items2, binding, null);
|
|
function _fun52154({parent_id}) { // fn#52154, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6786:1574, offset: 0x013207dd, size: 27 bytes, params: 2, frame: 2
|
|
return parent_id === env0_0.id;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function useFlattenedChannels(a0, a1) { // fn#52156, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6786:1921, offset: 0x013207f8, size: 85 bytes, params: 3, frame: 15
|
|
const value = a2;
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const env0_2 = value !== undefined ? value : false;
|
|
return (FluxModule).useStateFromStoresArray([ChannelStore], _fun52157);
|
|
function _fun52157() { // fn#52157, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:6786:2006, offset: 0x0132084d, size: 106 bytes, params: 1, frame: 19
|
|
const Array = global.Array;
|
|
const value3 = Array.from(require).map(function(a0) {
|
|
return ChannelStore.getChannel(a0);
|
|
});
|
|
return getFlattenedChannels(env0_0, require,
|
|
value3.filter((GlobalUtilsModule).isNotNullish), env0_2);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun52143, 6608, [1379, 22, 1360, 566,
|
|
2]) /* metro module 6608, dependencies: [1379, 22, 1360, 566, 2] */;
|