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

888 lines
46 KiB
TypeScript

/* Metro module 8039; source: modules/application_commands/CommandPermissionUtils.tsx; dependencies: [1383, 1867, 5066, 661, 8040, 7866, 5068, 1909, 483, 8042, 44, 5065, 5067, 2] */
import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
import * as ServerModule from '../../flow/Server.tsx'; /* Metro dependency 1909 */
import * as ApplicationCommandUtilsModule from './ApplicationCommandUtils.tsx'; /* Metro dependency 5065 */
import * as ApplicationCommandConstantsModule from './ApplicationCommandConstants.tsx'; /* Metro dependency 5066 */
import * as IntegrationPermissionUtilsModule from '../guild_settings/integrations/permission/IntegrationPermissionUtils.tsx'; /* Metro dependency 5067 */
import * as ApplicationCommandTypesModule from './ApplicationCommandTypes.tsx'; /* Metro dependency 5068 */
import * as ApplicationIntegrationTypeModule from '../../external/discord_common/js/shared/shared-constants/ApplicationIntegrationType.tsx'; /* Metro dependency 8042 */
function _fun63731(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#63731, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8217:6, offset: 0x01b8e615, size: 391 bytes, params: 8, frame: 23
const env0_0 = require;
const _arrayLikeToArray_63734 = 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 isExplicitAllow = function(a0) {
return a0 === true;
};
const isExplicitDeny = function(a0) {
return a0 === false;
};
const computeAllowedForChannel2 = computeAllowedForChannel;
const computeAllowedForUser2 = computeAllowedForUser;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object = {ALLOWED: 0};
object[0] = 'ALLOWED';
object.NSFW_NOT_ALLOWED = 1;
object[1] = 'NSFW_NOT_ALLOWED';
object.WRONG_COMMAND_TYPE = 2;
object[2] = 'WRONG_COMMAND_TYPE';
object.PREDICATE_FAILED = 3;
object[3] = 'PREDICATE_FAILED';
object.CONTEXT_NOT_ALLOWED = 4;
object[4] = 'CONTEXT_NOT_ALLOWED';
object.MISSING_BASE_PERMISSIONS = 5;
object[5] = 'MISSING_BASE_PERMISSIONS';
object.CHANNEL_DENIED = 6;
object[6] = 'CHANNEL_DENIED';
object.USER_DENIED = 7;
object[7] = 'USER_DENIED';
(FileImportTrackerModule).fileFinishedImporting('modules/application_commands/CommandPermissionUtils.tsx');
exports.HasAccessResult = object;
exports.hasAccess = hasAccess_63739;
exports.computeAllowedForChannel = computeAllowedForChannel2;
exports.computeAllowedForUser = computeAllowedForUser2;
function _createForOfIteratorHelperLoose_63732(a0, a1) { // fn#63732, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8217:190, offset: 0x01b8e79c, 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 _fun63733;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_63734(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_63734(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_63734(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun63733;
}
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 _fun63733() { // fn#63733, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8217:761, 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 computeAllowedForChannel(a0, a1, a2) { // fn#63737, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8217:1551, offset: 0x01b8e924, size: 227 bytes, params: 4, frame: 21
const value = null;
if (value == a0) {
return value;
}
const r7 = a1.isThread() && value != a1.parent_id ? a1.parent_id : a1.id;
let toPermissionKey = IntegrationPermissionUtilsModule.toPermissionKey;
const ApplicationCommandPermissionType = (ApplicationCommandTypesModule).ApplicationCommandPermissionType;
let CHANNEL = ApplicationCommandPermissionType.CHANNEL;
let property = a0[Reflect.apply(toPermissionKey, IntegrationPermissionUtilsModule, [r7, CHANNEL])];
if (value != property) {
return property.permission;
}
toPermissionKey = IntegrationPermissionUtilsModule.toPermissionKey;
const value3 = (ApplicationCommandUtilsModule).allChannelsSentinel(a2);
CHANNEL = ApplicationCommandPermissionType.CHANNEL;
property = a0[Reflect.apply(toPermissionKey, IntegrationPermissionUtilsModule, [value3, CHANNEL])];
return value != property ? property.permission : value;
}
function computeAllowedForUser(a0, a1, a2, a3, a4) { // fn#63738, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8217:1946, offset: 0x01b8ea07, size: 330 bytes, params: 6, frame: 27
var r11;
var r12;
var r3;
var permission;
var moduleValue;
var toPermissionKey;
const ApplicationCommandPermissionType = (ApplicationCommandTypesModule).ApplicationCommandPermissionType;
var property;
var value8;
var moduleValue2;
var ROLE;
var value9;
var moduleValue3;
const value = null;
if (value == a0) {
return value;
}
if (!a4) {
moduleValue = require(5067) /* metro dependency 5067: IntegrationPermissionUtils */;
toPermissionKey = moduleValue.toPermissionKey;
property = a0[Reflect.apply(toPermissionKey, moduleValue, [a2, ApplicationCommandPermissionType.USER])];
reducibleJoin4: while (true) {
if (value != property) {
return property.permission;
}
break reducibleJoin4;
}
}
const value4 = _createForOfIteratorHelperLoose_63732(a3);
const value5 = value4();
let done = value5.done;
const value6 = false;
const value7 = true;
if (done) {
r3 = value6;
} else {
r11 = value6;
r12 = value5;
reducibleLoop5: while (true) {
value8 = r12.value;
moduleValue2 = require(5067) /* metro dependency 5067: IntegrationPermissionUtils */;
toPermissionKey = moduleValue2.toPermissionKey;
ROLE = ApplicationCommandPermissionType.ROLE;
property = a0[Reflect.apply(toPermissionKey, moduleValue2, [value8, ROLE])];
if (value != property) {
permission = property.permission;
reducibleJoin7: while (true) {
if (permission) {
return value7;
}
r11 = value7;
break reducibleJoin7;
}
}
value9 = value4();
done = value9.done;
if (done) {
r3 = r11;
break reducibleLoop5;
}
r12 = value9;
continue reducibleLoop5;
}
}
if (r3) {
return value6;
}
reducibleJoin12: while (true) {
if (value != a1) {
moduleValue3 = require(5067) /* metro dependency 5067: IntegrationPermissionUtils */;
toPermissionKey = moduleValue3.toPermissionKey;
ROLE = ApplicationCommandPermissionType.ROLE;
property = a0[Reflect.apply(toPermissionKey, moduleValue3, [a1, ROLE])];
r3 = property;
break reducibleJoin12;
}
r3 = value;
break reducibleJoin12;
}
reducibleJoin14: while (true) {
if (value != r3) {
permission = r3.permission;
break reducibleJoin14;
}
permission = value;
break reducibleJoin14;
}
return permission;
}
function hasAccess_63739(a0, {context, commandTypes, allowNsfw, computedPermissions, userId, roleIds, isImpersonating, hasBaseAccessPermissions, hasSendMessagesPermission}, {applicationAllowedForUser, applicationAllowedForChannel, isGuildInstalled, isUserInstalled, commandBotId}) { // fn#63739, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8217:2610, offset: 0x01b8eb51, size: 1204 bytes, params: 4, frame: 33
var r9;
var r2;
var r1;
var value;
var applicationId;
var value2;
var moduleValue;
var computeCommandContextType;
var commandContextType;
var contexts;
var inputType;
var value3;
const ApplicationCommandInputType = (ApplicationCommandTypesModule).ApplicationCommandInputType;
var BOT;
var dmPermission;
const InteractionContextType = (ServerModule).InteractionContextType;
var BOT_DM;
var PRIVATE_CHANNEL;
var predicate;
var value4;
var guildStoreBinding;
var getGuild;
var guild_id;
var value5;
var object;
var value6;
var BUILT_IN;
var moduleValue2;
var getContextGuildId;
var value7;
var moduleValue3;
var has;
var ADMINISTRATOR;
var integration_types;
const ApplicationIntegrationType = (ApplicationIntegrationTypeModule).ApplicationIntegrationType;
var USER_INSTALL;
var GUILD_INSTALL;
var defaultImport;
var permissions;
var allowedForChannel;
var computeAllowedForUserBinding;
var allowedForUser;
var defaultMemberPermissions;
var ALLOWED;
var moduleValue4;
var equals;
const DISABLED_BY_DEFAULT_PERMISSION_FLAG = (ApplicationCommandUtilsModule).DISABLED_BY_DEFAULT_PERMISSION_FLAG;
var USER_DENIED;
let includes = commandTypes.includes;
if (Reflect.apply(includes, commandTypes, [a0.type])) {
if (!a0.nsfw) {
value = importDefault(8040) /* metro dependency 8040: isApplicationAgeRestricted */;
applicationId = a0.applicationId;
reducibleJoin4: while (true) {
if (!value(applicationId)) {
value = undefined;
reducibleJoin8: while (true) {
if (context != null) {
value2 = environment;
moduleValue = require(7866) /* metro dependency 7866: CommandPermissionContext */;
computeCommandContextType = moduleValue.computeCommandContextType;
commandContextType = Reflect.apply(computeCommandContextType, moduleValue, [context,
commandBotId]);
r9 = commandContextType;
break reducibleJoin8;
}
r9 = value;
break reducibleJoin8;
}
contexts = a0.contexts;
if (contexts != null) {
reducibleJoin18: while (true) {
if (r9 == null) {
break reducibleJoin18;
}
contexts = a0.contexts;
includes = contexts.includes;
if (!Reflect.apply(includes, contexts, [r9])) {
value = environment;
return env0_8.CONTEXT_NOT_ALLOWED;
}
break reducibleJoin18;
}
} else {
inputType = a0.inputType;
value3 = environment;
BOT = ApplicationCommandInputType.BOT;
reducibleJoin18: while (true) {
if (inputType !== BOT) {
break reducibleJoin18;
}
dmPermission = a0.dmPermission;
if (dmPermission === false) {
BOT_DM = InteractionContextType.BOT_DM;
reducibleJoin12: while (true) {
if (r9 === BOT_DM) {
return env0_8.CONTEXT_NOT_ALLOWED;
}
break reducibleJoin12;
}
}
PRIVATE_CHANNEL = InteractionContextType.PRIVATE_CHANNEL;
if (r9 === PRIVATE_CHANNEL) {
return env0_8.CONTEXT_NOT_ALLOWED;
}
break reducibleJoin18;
}
}
predicate = a0.predicate;
if (predicate != null) {
value4 = environment;
reducibleJoin22: while (true) {
if (context instanceof ChannelRecordBase) {
guildStoreBinding = GuildStore;
getGuild = guildStoreBinding.getGuild;
guild_id = context.guild_id;
value5 = Reflect.apply(getGuild, guildStoreBinding, [guild_id]);
predicate = a0.predicate;
object = {channel: context, guild: value5};
if (!Reflect.apply(predicate, a0, [object])) {
return env0_8.PREDICATE_FAILED;
}
break reducibleJoin22;
}
break reducibleJoin22;
}
}
applicationId = a0.applicationId;
value6 = environment;
BUILT_IN = BuiltInSectionId.BUILT_IN;
if (applicationId === BUILT_IN) {
return env0_8.ALLOWED;
}
reducibleJoin25: while (true) {
if (context != null) {
moduleValue2 = require(7866) /* metro dependency 7866: CommandPermissionContext */;
getContextGuildId = moduleValue2.getContextGuildId;
value7 = Reflect.apply(getContextGuildId, moduleValue2, [context]);
r9 = value7;
break reducibleJoin25;
}
r9 = value;
break reducibleJoin25;
}
if (r9 == null) {
return env0_8.ALLOWED;
}
moduleValue3 = importAll(483) /* metro dependency 483: BigFlagUtils */;
has = moduleValue3.has;
ADMINISTRATOR = Permissions.ADMINISTRATOR;
if (Reflect.apply(has, moduleValue3, [computedPermissions, ADMINISTRATOR])) {
return env0_8.ALLOWED;
}
if (isUserInstalled) {
integration_types = a0.integration_types;
reducibleJoin30: while (true) {
if (integration_types == null) {
break reducibleJoin30;
}
includes = integration_types.includes;
USER_INSTALL = ApplicationIntegrationType.USER_INSTALL;
if (Reflect.apply(includes, integration_types, [USER_INSTALL])) {
return env0_8.ALLOWED;
}
break reducibleJoin30;
}
}
if (hasBaseAccessPermissions) {
reducibleJoin32: while (true) {
if (hasSendMessagesPermission) {
if (context instanceof ChannelRecordBase) {
defaultImport = importDefault(44) /* metro dependency 44 */;
defaultImport(value !== applicationAllowedForChannel,
'missing applicationAllowedForChannel');
allowedForChannel = computeAllowedForChannel(a0.permissions, context, r9);
if (isExplicitDeny(allowedForChannel)) {
return env0_8.CHANNEL_DENIED;
}
reducibleJoin41: while (true) {
if (isExplicitAllow(allowedForChannel)) {
break reducibleJoin41;
}
if (isExplicitDeny(applicationAllowedForChannel)) {
return env0_8.CHANNEL_DENIED;
}
break reducibleJoin41;
}
}
computeAllowedForUserBinding = computeAllowedForUser;
permissions = a0.permissions;
allowedForUser = computeAllowedForUserBinding(permissions, r9, userId, roleIds,
isImpersonating);
if (isExplicitAllow(allowedForUser)) {
ALLOWED = env0_8.ALLOWED;
r1 = ALLOWED;
} else {
reducibleJoin53: while (true) {
reducibleJoin52: while (true) {
if (isExplicitDeny(allowedForUser)) {
break reducibleJoin52;
}
if (isExplicitDeny(applicationAllowedForUser)) {
break reducibleJoin52;
}
defaultMemberPermissions = a0.defaultMemberPermissions;
if (defaultMemberPermissions != null) {
moduleValue4 = importAll(483) /* metro dependency 483: BigFlagUtils */;
equals = moduleValue4.equals;
defaultMemberPermissions = a0.defaultMemberPermissions;
reducibleJoin50: while (true) {
reducibleJoin49: while (true) {
if (Reflect.apply(equals, moduleValue4,
[defaultMemberPermissions,
DISABLED_BY_DEFAULT_PERMISSION_FLAG])) {
break reducibleJoin49;
}
value = importAll(483) /* metro dependency 483: BigFlagUtils */;
has = value.has;
defaultMemberPermissions = a0.defaultMemberPermissions;
if (Reflect.apply(has, value, [computedPermissions,
defaultMemberPermissions])) {
ALLOWED = env0_8.ALLOWED;
r2 = ALLOWED;
break reducibleJoin50;
}
break reducibleJoin49;
}
USER_DENIED = env0_8.USER_DENIED;
r2 = USER_DENIED;
break reducibleJoin50;
}
r1 = r2;
} else {
ALLOWED = env0_8.ALLOWED;
r1 = ALLOWED;
}
break reducibleJoin53;
}
USER_DENIED = env0_8.USER_DENIED;
r1 = USER_DENIED;
break reducibleJoin53;
}
}
return r1;
}
break reducibleJoin32;
}
}
if (isGuildInstalled) {
integration_types = a0.integration_types;
reducibleJoin36: while (true) {
reducibleJoin35: while (true) {
if (integration_types == null) {
break reducibleJoin35;
}
integration_types = a0.integration_types;
includes = integration_types.includes;
GUILD_INSTALL = ApplicationIntegrationType.GUILD_INSTALL;
if (Reflect.apply(includes, integration_types, [GUILD_INSTALL])) {
break reducibleJoin35;
}
break reducibleJoin36;
}
return env0_8.MISSING_BASE_PERMISSIONS;
}
}
if (context instanceof ChannelRecordBase) {
defaultImport = importDefault(44) /* metro dependency 44 */;
defaultImport(value !== applicationAllowedForChannel, 'missing applicationAllowedForChannel');
allowedForChannel = computeAllowedForChannel(a0.permissions, context, r9);
if (isExplicitDeny(allowedForChannel)) {
return env0_8.CHANNEL_DENIED;
}
reducibleJoin41: while (true) {
if (isExplicitAllow(allowedForChannel)) {
break reducibleJoin41;
}
if (isExplicitDeny(applicationAllowedForChannel)) {
return env0_8.CHANNEL_DENIED;
}
break reducibleJoin41;
}
}
computeAllowedForUserBinding = computeAllowedForUser;
permissions = a0.permissions;
allowedForUser = computeAllowedForUserBinding(permissions, r9, userId, roleIds, isImpersonating);
if (isExplicitAllow(allowedForUser)) {
ALLOWED = env0_8.ALLOWED;
r1 = ALLOWED;
} else {
reducibleJoin53: while (true) {
reducibleJoin52: while (true) {
if (isExplicitDeny(allowedForUser)) {
break reducibleJoin52;
}
if (isExplicitDeny(applicationAllowedForUser)) {
break reducibleJoin52;
}
defaultMemberPermissions = a0.defaultMemberPermissions;
if (defaultMemberPermissions != null) {
moduleValue4 = importAll(483) /* metro dependency 483: BigFlagUtils */;
equals = moduleValue4.equals;
defaultMemberPermissions = a0.defaultMemberPermissions;
reducibleJoin50: while (true) {
reducibleJoin49: while (true) {
if (Reflect.apply(equals, moduleValue4, [defaultMemberPermissions,
DISABLED_BY_DEFAULT_PERMISSION_FLAG])) {
break reducibleJoin49;
}
value = importAll(483) /* metro dependency 483: BigFlagUtils */;
has = value.has;
defaultMemberPermissions = a0.defaultMemberPermissions;
if (Reflect.apply(has, value, [computedPermissions,
defaultMemberPermissions])) {
ALLOWED = env0_8.ALLOWED;
r2 = ALLOWED;
break reducibleJoin50;
}
break reducibleJoin49;
}
USER_DENIED = env0_8.USER_DENIED;
r2 = USER_DENIED;
break reducibleJoin50;
}
r1 = r2;
} else {
ALLOWED = env0_8.ALLOWED;
r1 = ALLOWED;
}
break reducibleJoin53;
}
USER_DENIED = env0_8.USER_DENIED;
r1 = USER_DENIED;
break reducibleJoin53;
}
}
return r1;
}
break reducibleJoin4;
}
}
if (allowNsfw) {
value = undefined;
reducibleJoin8: while (true) {
if (context != null) {
value2 = environment;
moduleValue = require(7866) /* metro dependency 7866: CommandPermissionContext */;
computeCommandContextType = moduleValue.computeCommandContextType;
commandContextType = Reflect.apply(computeCommandContextType, moduleValue, [context, commandBotId]);
r9 = commandContextType;
break reducibleJoin8;
}
r9 = value;
break reducibleJoin8;
}
contexts = a0.contexts;
if (contexts != null) {
reducibleJoin18: while (true) {
if (r9 == null) {
break reducibleJoin18;
}
contexts = a0.contexts;
includes = contexts.includes;
if (!Reflect.apply(includes, contexts, [r9])) {
value = environment;
return env0_8.CONTEXT_NOT_ALLOWED;
}
break reducibleJoin18;
}
} else {
reducibleJoin18: while (true) {
if (a0.inputType !== ApplicationCommandInputType.BOT) {
break reducibleJoin18;
}
dmPermission = a0.dmPermission;
if (dmPermission === false) {
BOT_DM = InteractionContextType.BOT_DM;
reducibleJoin12: while (true) {
if (r9 === BOT_DM) {
return env0_8.CONTEXT_NOT_ALLOWED;
}
break reducibleJoin12;
}
}
PRIVATE_CHANNEL = InteractionContextType.PRIVATE_CHANNEL;
if (r9 === PRIVATE_CHANNEL) {
return env0_8.CONTEXT_NOT_ALLOWED;
}
break reducibleJoin18;
}
}
predicate = a0.predicate;
if (predicate != null) {
reducibleJoin22: while (true) {
if (context instanceof ChannelRecordBase) {
guildStoreBinding = GuildStore;
getGuild = guildStoreBinding.getGuild;
guild_id = context.guild_id;
value5 = Reflect.apply(getGuild, guildStoreBinding, [guild_id]);
predicate = a0.predicate;
object = {channel: context, guild: value5};
if (!Reflect.apply(predicate, a0, [object])) {
return env0_8.PREDICATE_FAILED;
}
break reducibleJoin22;
}
break reducibleJoin22;
}
}
if (a0.applicationId === BuiltInSectionId.BUILT_IN) {
return env0_8.ALLOWED;
}
reducibleJoin25: while (true) {
if (context != null) {
moduleValue2 = require(7866) /* metro dependency 7866: CommandPermissionContext */;
getContextGuildId = moduleValue2.getContextGuildId;
value7 = Reflect.apply(getContextGuildId, moduleValue2, [context]);
r9 = value7;
break reducibleJoin25;
}
r9 = value;
break reducibleJoin25;
}
if (r9 == null) {
return env0_8.ALLOWED;
}
moduleValue3 = importAll(483) /* metro dependency 483: BigFlagUtils */;
has = moduleValue3.has;
if (Reflect.apply(has, moduleValue3, [computedPermissions, Permissions.ADMINISTRATOR])) {
return env0_8.ALLOWED;
}
if (isUserInstalled) {
integration_types = a0.integration_types;
reducibleJoin30: while (true) {
if (integration_types == null) {
break reducibleJoin30;
}
includes = integration_types.includes;
USER_INSTALL = ApplicationIntegrationType.USER_INSTALL;
if (Reflect.apply(includes, integration_types, [USER_INSTALL])) {
return env0_8.ALLOWED;
}
break reducibleJoin30;
}
}
if (hasBaseAccessPermissions) {
reducibleJoin32: while (true) {
if (hasSendMessagesPermission) {
if (context instanceof ChannelRecordBase) {
defaultImport = importDefault(44) /* metro dependency 44 */;
defaultImport(value !== applicationAllowedForChannel,
'missing applicationAllowedForChannel');
allowedForChannel = computeAllowedForChannel(a0.permissions, context, r9);
if (isExplicitDeny(allowedForChannel)) {
return env0_8.CHANNEL_DENIED;
}
reducibleJoin41: while (true) {
if (isExplicitAllow(allowedForChannel)) {
break reducibleJoin41;
}
if (isExplicitDeny(applicationAllowedForChannel)) {
return env0_8.CHANNEL_DENIED;
}
break reducibleJoin41;
}
}
computeAllowedForUserBinding = computeAllowedForUser;
permissions = a0.permissions;
allowedForUser = computeAllowedForUserBinding(permissions, r9, userId, roleIds,
isImpersonating);
if (isExplicitAllow(allowedForUser)) {
ALLOWED = env0_8.ALLOWED;
r1 = ALLOWED;
} else {
reducibleJoin53: while (true) {
reducibleJoin52: while (true) {
if (isExplicitDeny(allowedForUser)) {
break reducibleJoin52;
}
if (isExplicitDeny(applicationAllowedForUser)) {
break reducibleJoin52;
}
defaultMemberPermissions = a0.defaultMemberPermissions;
if (defaultMemberPermissions != null) {
moduleValue4 = importAll(483) /* metro dependency 483: BigFlagUtils */;
equals = moduleValue4.equals;
defaultMemberPermissions = a0.defaultMemberPermissions;
reducibleJoin50: while (true) {
reducibleJoin49: while (true) {
if (Reflect.apply(equals, moduleValue4, [defaultMemberPermissions,
DISABLED_BY_DEFAULT_PERMISSION_FLAG])) {
break reducibleJoin49;
}
value = importAll(483) /* metro dependency 483: BigFlagUtils */;
has = value.has;
defaultMemberPermissions = a0.defaultMemberPermissions;
if (Reflect.apply(has, value, [computedPermissions,
defaultMemberPermissions])) {
ALLOWED = env0_8.ALLOWED;
r2 = ALLOWED;
break reducibleJoin50;
}
break reducibleJoin49;
}
USER_DENIED = env0_8.USER_DENIED;
r2 = USER_DENIED;
break reducibleJoin50;
}
r1 = r2;
} else {
ALLOWED = env0_8.ALLOWED;
r1 = ALLOWED;
}
break reducibleJoin53;
}
USER_DENIED = env0_8.USER_DENIED;
r1 = USER_DENIED;
break reducibleJoin53;
}
}
return r1;
}
break reducibleJoin32;
}
}
if (isGuildInstalled) {
integration_types = a0.integration_types;
reducibleJoin36: while (true) {
reducibleJoin35: while (true) {
if (integration_types == null) {
break reducibleJoin35;
}
integration_types = a0.integration_types;
includes = integration_types.includes;
GUILD_INSTALL = ApplicationIntegrationType.GUILD_INSTALL;
if (Reflect.apply(includes, integration_types, [GUILD_INSTALL])) {
break reducibleJoin35;
}
break reducibleJoin36;
}
return env0_8.MISSING_BASE_PERMISSIONS;
}
}
if (context instanceof ChannelRecordBase) {
(importDefault(44) /* metro dependency 44 */)(value !== applicationAllowedForChannel,
'missing applicationAllowedForChannel');
allowedForChannel = computeAllowedForChannel(a0.permissions, context, r9);
if (isExplicitDeny(allowedForChannel)) {
return env0_8.CHANNEL_DENIED;
}
reducibleJoin41: while (true) {
if (isExplicitAllow(allowedForChannel)) {
break reducibleJoin41;
}
if (isExplicitDeny(applicationAllowedForChannel)) {
return env0_8.CHANNEL_DENIED;
}
break reducibleJoin41;
}
}
computeAllowedForUserBinding = computeAllowedForUser;
permissions = a0.permissions;
allowedForUser = computeAllowedForUserBinding(permissions, r9, userId, roleIds, isImpersonating);
if (isExplicitAllow(allowedForUser)) {
r1 = env0_8.ALLOWED;
} else {
reducibleJoin53: while (true) {
reducibleJoin52: while (true) {
if (isExplicitDeny(allowedForUser)) {
break reducibleJoin52;
}
if (isExplicitDeny(applicationAllowedForUser)) {
break reducibleJoin52;
}
defaultMemberPermissions = a0.defaultMemberPermissions;
if (defaultMemberPermissions != null) {
moduleValue4 = importAll(483) /* metro dependency 483: BigFlagUtils */;
equals = moduleValue4.equals;
defaultMemberPermissions = a0.defaultMemberPermissions;
reducibleJoin50: while (true) {
reducibleJoin49: while (true) {
if (Reflect.apply(equals, moduleValue4, [defaultMemberPermissions,
DISABLED_BY_DEFAULT_PERMISSION_FLAG])) {
break reducibleJoin49;
}
value = importAll(483) /* metro dependency 483: BigFlagUtils */;
has = value.has;
defaultMemberPermissions = a0.defaultMemberPermissions;
if (Reflect.apply(has, value, [computedPermissions, defaultMemberPermissions])) {
ALLOWED = env0_8.ALLOWED;
r2 = ALLOWED;
break reducibleJoin50;
}
break reducibleJoin49;
}
USER_DENIED = env0_8.USER_DENIED;
r2 = USER_DENIED;
break reducibleJoin50;
}
r1 = r2;
} else {
ALLOWED = env0_8.ALLOWED;
r1 = ALLOWED;
}
break reducibleJoin53;
}
USER_DENIED = env0_8.USER_DENIED;
r1 = USER_DENIED;
break reducibleJoin53;
}
}
return r1;
}
return env0_8.NSFW_NOT_ALLOWED;
}
return env0_8.WRONG_COMMAND_TYPE;
}
}
global.__d(_fun63731, 8039, [1383, 1867, 5066, 661, 8040, 7866, 5068, 1909, 483, 8042, 44, 5065, 5067,
2]) /* metro module 8039, dependencies: [1383, 1867, 5066, 661, 8040, 7866, 5068, 1909, 483, 8042, 44, 5065, 5067, 2] */;