Files
discord-decomp/sources/utils/native/InstantInviteUtils.tsx
T
2026-07-28 01:06:53 +03:00

234 lines
12 KiB
TypeScript

/* Metro module 9154; source: utils/native/InstantInviteUtils.tsx; dependencies: [1379, 1935, 3784, 661, 1244, 9050, 566, 2] */
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildChannelStore from '../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */
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 ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as GuildChannelStoreModule from '../../stores/GuildChannelStore.tsx'; /* Metro dependency 1935 */
function _fun71749(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#71749, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9339:6, offset: 0x01d2c5c1, size: 809 bytes, params: 8, frame: 37
let env0_0 = require;
const closure = function(a0, a1) {
var value = a1;
var value2 = a2;
var env0_0 = value;
var env0_1 = value2 !== undefined ? value2 : value;
var object = {value: a0};
Object.defineProperty(object, 'label', {get: _fun71751, set: undefined, enumerable: true, configurable: true});
Object.defineProperty(object, 'descriptiveLabel', {get: _fun71752, set: undefined, enumerable: true,
configurable: true});
return object;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = GuildChannelStoreModule;
const env0_3 = value.GUILD_SELECTABLE_CHANNELS_KEY;
const env0_4 = value.GUILD_VOCAL_CHANNELS_KEY;
value = closure(0, function() {
return require(dependencyMap[4]).intl.string(require(dependencyMap[4]).t.PqEzn8);
}, function() {
return require(dependencyMap[4]).intl.string(require(dependencyMap[4]).t['5u4A6V']);
});
let value2 = closure(604800, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t['k2UNz+'], {days: 7});
});
const value3 = closure(1209600, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t['k2UNz+'], {days: 14});
});
const value4 = closure(2592000, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t['k2UNz+'], {days: 30});
});
const value5 = closure(5184000, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t['k2UNz+'], {days: 60});
});
const value6 = closure(86400, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t['k2UNz+'], {days: 1});
});
const value7 = closure(43200, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.xCjYxK, {hours: 12});
});
const value8 = closure(21600, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.xCjYxK, {hours: 6});
});
const value9 = closure(28800, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.xCjYxK, {hours: 8});
});
const value10 = closure(3600, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.xCjYxK, {hours: 1});
});
const value11 = closure(1800, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.opVZ9q, {mins: 30});
}, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.iXLF9W, {minutes: 30});
});
items2 = [value, value5, value4, value3, value2, value6, value7, value8, value10, value11];
const value12 = closure(0, function() {
return '∞';
}, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.gPl14C, {maxUses: 0});
});
const value13 = closure(1, function() {
return '1';
}, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.gPl14C, {maxUses: 1});
});
const value14 = closure(5, function() {
return '5';
}, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.gPl14C, {maxUses: 5});
});
const value15 = closure(10, function() {
return '10';
}, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.gPl14C, {maxUses: 10});
});
const value16 = closure(25, function() {
return '25';
}, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.gPl14C, {maxUses: 25});
});
const value17 = closure(50, function() {
return '50';
}, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.gPl14C, {maxUses: 50});
});
const value18 = closure(100, function() {
return '100';
}, function() {
return require(dependencyMap[4]).intl.formatToPlainString(require(dependencyMap[4]).t.gPl14C, {maxUses: 100});
});
const items3 = [value12, value13, value14, value15, value16, value17, value18];
(FileImportTrackerModule).fileFinishedImporting('utils/native/InstantInviteUtils.tsx');
exports.INVITE_OPTIONS_FOREVER = value;
exports.INVITE_OPTIONS_7_DAYS = value2;
exports.INVITE_OPTIONS_14_DAYS = value3;
exports.INVITE_OPTIONS_30_DAYS = value4;
exports.INVITE_OPTIONS_60_DAYS = value5;
exports.INVITE_OPTIONS_1_DAY = value6;
exports.INVITE_OPTIONS_12_HOURS = value7;
exports.INVITE_OPTIONS_6_HOURS = value8;
exports.INVITE_OPTIONS_8_HOURS = value9;
exports.INVITE_OPTIONS_1_HOUR = value10;
exports.INVITE_OPTIONS_30_MINUTES = value11;
exports.MAX_AGE_OPTIONS = items2;
exports.INVITE_OPTIONS_UNLIMITED = value12;
exports.INVITE_OPTIONS_ONCE = value13;
exports.INVITE_OPTIONS_5_TIMES = value14;
exports.INVITE_OPTIONS_10_TIMES = value15;
exports.INVITE_OPTIONS_25_TIMES = value16;
exports.INVITE_OPTIONS_50_TIMES = value17;
exports.INVITE_OPTIONS_100_TIMES = value18;
exports.MAX_USES_OPTIONS = items3;
exports.getInviteChannelId = getInviteChannelId;
exports.shouldRenderInvite = shouldRenderInvite;
exports.useShouldShowInviteInActionBar = useShouldShowInviteInActionBar;
function makeOption(a0, a1) { // fn#71750, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9339:221, offset: 0x01d2c8ea, size: 70 bytes, params: 3, frame: 5
const value = a1;
const value2 = a2;
const env0_1 = value2 !== undefined ? value2 : value;
const object = {value: a0};
Object.defineProperty(object, 'label', {get: function() {
return require();
}, set: undefined, enumerable: true, configurable: true});
Object.defineProperty(object, 'descriptiveLabel', {get: _fun71752, set: undefined, enumerable: true,
configurable: true});
return object;
function _fun71751() { // fn#71751, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9339:265, offset: 0x00cefeb4, size: 15 bytes, params: 1, frame: 9
return require();
}
function _fun71752() { // fn#71752, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9339:289, offset: 0x01025531, size: 15 bytes, params: 1, frame: 9
return env0_1();
}
}
function getInviteChannelId(a0, a1) { // fn#71780, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9339:2738, offset: 0x01d2cf07, size: 195 bytes, params: 3, frame: 19
var r1;
var permissionStoreBinding;
var canWithPartialContext2;
var value5;
var channel;
const value = a0;
const value2 = null;
if (value2 == a1) {
return value2;
}
if (value2 != value) {
permissionStoreBinding = PermissionStore;
canWithPartialContext2 = permissionStoreBinding.canWithPartialContext(Permissions.CREATE_INSTANT_INVITE,
{channelId: value});
value5 = a1[GUILD_SELECTABLE_CHANNELS_KEY].concat(a1[GUILD_VOCAL_CHANNELS_KEY]).find(function({channel}) {
return PermissionStore.can(Permissions.CREATE_INSTANT_INVITE, channel);
});
if (canWithPartialContext2) {
channel = ChannelStore.getChannel(value);
r1 = value2 == channel ? value : channel.isThread() ? value2 == channel.parent_id ? value : channel.parent_id : value;
} else {
r1 = value2 != value5 ? value5.channel.id : value2;
}
} else {
r1 = value2;
}
return r1;
}
function shouldRenderInvite(a0, a1) { // fn#71782, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9339:3109, offset: 0x01d2cff1, size: 163 bytes, params: 3, frame: 19
var r1;
let value = undefined;
const value2 = (a1 == null ? value : a1.vanityURLCode) == null;
if (value2) {
r1 = value2;
} else {
value = require(9050) /* metro dependency 9050: canViewInviteModal */;
value = !value.canViewInviteModal(PermissionStore, a1);
r1 = value;
}
return r1 ? a0 != null && (a0[GUILD_SELECTABLE_CHANNELS_KEY].find(function({channel}) {
return PermissionStore.can(Permissions.CREATE_INSTANT_INVITE, channel);
}) != null || a0[GUILD_VOCAL_CHANNELS_KEY].find(_fun71784) != null) : !r1;
function _fun71784({channel}) { // fn#71784, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9339:3320, offset: 0x01d2cfca, size: 39 bytes, params: 2, frame: 13
const permissionStoreBinding = PermissionStore;
const can = permissionStoreBinding.can;
const CREATE_INSTANT_INVITE = Permissions.CREATE_INSTANT_INVITE;
return Reflect.apply(can, permissionStoreBinding, [CREATE_INSTANT_INVITE, channel]);
}
}
function useShouldShowInviteInActionBar(a0) { // fn#71785, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9339:3405, offset: 0x01d2d094, size: 226 bytes, params: 2, frame: 20
var r1;
var moduleValue2;
const env0_0 = a0;
const value2 = undefined;
const value3 = (FluxModule).useStateFromStoresObject([GuildChannelStore],
_fun71786, [a0.id]);
const value4 = (a0 == null ? value2 : a0.vanityURLCode) == null;
if (value4) {
r1 = value4;
} else {
moduleValue2 = require(9050) /* metro dependency 9050: canViewInviteModal */;
r1 = !moduleValue2.canViewInviteModal(PermissionStore, a0);
}
return r1 ? value3 == null || (value3[GUILD_SELECTABLE_CHANNELS_KEY].find(function({channel}) {
return PermissionStore.can(Permissions.CREATE_INSTANT_INVITE, channel);
}) != null || value3[GUILD_VOCAL_CHANNELS_KEY].find(_fun71788) != null) : !r1;
function _fun71786() { // fn#71786, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9339:3492, offset: 0x01d2d176, size: 32 bytes, params: 1, frame: 11
return GuildChannelStore.getChannels(env0_0.id);
}
function _fun71788({channel}) { // fn#71788, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9339:3704, offset: 0x01d2cfca, size: 39 bytes, params: 2, frame: 13
const permissionStoreBinding = PermissionStore;
const can = permissionStoreBinding.can;
const CREATE_INSTANT_INVITE = Permissions.CREATE_INSTANT_INVITE;
return Reflect.apply(can, permissionStoreBinding, [CREATE_INSTANT_INVITE, channel]);
}
}
}
global.__d(_fun71749, 9154, [1379, 1935, 3784, 661, 1244, 9050, 566,
2]) /* metro module 9154, dependencies: [1379, 1935, 3784, 661, 1244, 9050, 566, 2] */;