decord/source/utils/native/InstantInviteUtils.tsx
2026-08-14 17:33:39 +00:00

296 lines
12 KiB
TypeScript

// Module ID: 9131
// Function ID: 9132
// Name: get label
// Dependencies: [1391, 1980, 3989, 676, 1236, 9022, 589, 2]
// Exports: getInviteChannelId, shouldRenderInvite, useShouldShowInviteInActionBar
// Module 9131 (get label)
import ensureGuildLoaded from "ensureGuildLoaded";
import comparator from "comparator";
import closure_5 from "comparator";
import getUncachedChannelPermissions from "getUncachedChannelPermissions";
import { Permissions } from "ME";
let c3;
let c4;
let f46016 = arg1;
let f46017 = dependencyMap;
({ GUILD_SELECTABLE_CHANNELS_KEY: c3, GUILD_VOCAL_CHANNELS_KEY: c4 } = comparator);
f46016 = () => {
const intl = f46016(f46017[4]).intl;
return intl.string(f46016(f46017[4]).t.PqEzn8);
};
f46017 = () => {
const intl = f46016(f46017[4]).intl;
return intl.string(f46016(f46017[4]).t["5u4A6V"]);
};
let obj = { value: 0 };
Object.defineProperty(obj, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj, "descriptiveLabel", { get: () => f46017(), set: undefined });
const fn = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t["k2UNz+"], { days: 7 });
};
f46016 = fn;
f46017 = fn;
obj = { value: 604800 };
Object.defineProperty(obj, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj, "descriptiveLabel", { get: () => f46017(), set: undefined });
const fn2 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t["k2UNz+"], { days: 14 });
};
f46016 = fn2;
f46017 = fn2;
obj = { value: 1209600 };
Object.defineProperty(obj, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj, "descriptiveLabel", { get: () => f46017(), set: undefined });
const fn3 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t["k2UNz+"], { days: 30 });
};
f46016 = fn3;
f46017 = fn3;
const obj1 = { value: 2592000 };
Object.defineProperty(obj1, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj1, "descriptiveLabel", { get: () => f46017(), set: undefined });
const fn4 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t["k2UNz+"], { days: 60 });
};
f46016 = fn4;
f46017 = fn4;
let obj2 = { value: 5184000 };
Object.defineProperty(obj2, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj2, "descriptiveLabel", { get: () => f46017(), set: undefined });
const fn5 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t["k2UNz+"], { days: 1 });
};
f46016 = fn5;
f46017 = fn5;
const obj3 = { value: 86400 };
Object.defineProperty(obj3, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj3, "descriptiveLabel", { get: () => f46017(), set: undefined });
const fn6 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.xCjYxK, { hours: 12 });
};
f46016 = fn6;
f46017 = fn6;
const obj4 = { value: 43200 };
Object.defineProperty(obj4, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj4, "descriptiveLabel", { get: () => f46017(), set: undefined });
const fn7 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.xCjYxK, { hours: 6 });
};
f46016 = fn7;
f46017 = fn7;
const obj5 = { value: 21600 };
Object.defineProperty(obj5, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj5, "descriptiveLabel", { get: () => f46017(), set: undefined });
const fn8 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.xCjYxK, { hours: 8 });
};
f46016 = fn8;
f46017 = fn8;
const obj6 = { value: 28800 };
Object.defineProperty(obj6, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj6, "descriptiveLabel", { get: () => f46017(), set: undefined });
const fn9 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.xCjYxK, { hours: 1 });
};
f46016 = fn9;
f46017 = fn9;
const obj7 = { value: 3600 };
Object.defineProperty(obj7, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj7, "descriptiveLabel", { get: () => f46017(), set: undefined });
f46016 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.opVZ9q, { mins: 30 });
};
f46017 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.iXLF9W, { minutes: 30 });
};
const obj8 = { value: 1800 };
Object.defineProperty(obj8, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj8, "descriptiveLabel", { get: () => f46017(), set: undefined });
let items = [obj, obj2, obj1, obj, obj, obj3, obj4, obj5, obj7, obj8];
f46016 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t["r/IcuP"], { maxUses: 0 });
};
f46017 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.gPl14C, { maxUses: 0 });
};
const obj9 = { value: 0 };
Object.defineProperty(obj9, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj9, "descriptiveLabel", { get: () => f46017(), set: undefined });
f46016 = () => "1";
f46017 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.gPl14C, { maxUses: 1 });
};
const obj10 = { value: 1 };
Object.defineProperty(obj10, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj10, "descriptiveLabel", { get: () => f46017(), set: undefined });
f46016 = () => "5";
f46017 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.gPl14C, { maxUses: 5 });
};
const obj11 = { value: 5 };
Object.defineProperty(obj11, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj11, "descriptiveLabel", { get: () => f46017(), set: undefined });
f46016 = () => "10";
f46017 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.gPl14C, { maxUses: 10 });
};
const obj12 = { value: 10 };
Object.defineProperty(obj12, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj12, "descriptiveLabel", { get: () => f46017(), set: undefined });
f46016 = () => "25";
f46017 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.gPl14C, { maxUses: 25 });
};
const obj13 = { value: 25 };
Object.defineProperty(obj13, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj13, "descriptiveLabel", { get: () => f46017(), set: undefined });
f46016 = () => "50";
f46017 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.gPl14C, { maxUses: 50 });
};
const obj14 = { value: 50 };
Object.defineProperty(obj14, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj14, "descriptiveLabel", { get: () => f46017(), set: undefined });
f46016 = () => "100";
f46017 = () => {
const intl = f46016(f46017[4]).intl;
return intl.formatToPlainString(f46016(f46017[4]).t.gPl14C, { maxUses: 100 });
};
const obj15 = { value: 100 };
Object.defineProperty(obj15, "label", { get: () => f46016(), set: undefined });
Object.defineProperty(obj15, "descriptiveLabel", { get: () => f46017(), set: undefined });
let items1 = [obj9, obj10, obj11, obj12, obj13, obj14, obj15];
let result = require("getUncachedChannelPermissions").fileFinishedImporting("utils/native/InstantInviteUtils.tsx");
export const INVITE_OPTIONS_FOREVER = obj;
export const INVITE_OPTIONS_7_DAYS = obj;
export const INVITE_OPTIONS_14_DAYS = obj;
export const INVITE_OPTIONS_30_DAYS = obj1;
export const INVITE_OPTIONS_60_DAYS = obj2;
export const INVITE_OPTIONS_1_DAY = obj3;
export const INVITE_OPTIONS_12_HOURS = obj4;
export const INVITE_OPTIONS_6_HOURS = obj5;
export const INVITE_OPTIONS_8_HOURS = obj6;
export const INVITE_OPTIONS_1_HOUR = obj7;
export const INVITE_OPTIONS_30_MINUTES = obj8;
export const MAX_AGE_OPTIONS = items;
export const INVITE_OPTIONS_UNLIMITED = obj9;
export const INVITE_OPTIONS_ONCE = obj10;
export const INVITE_OPTIONS_5_TIMES = obj11;
export const INVITE_OPTIONS_10_TIMES = obj12;
export const INVITE_OPTIONS_25_TIMES = obj13;
export const INVITE_OPTIONS_50_TIMES = obj14;
export const INVITE_OPTIONS_100_TIMES = obj15;
export const MAX_USES_OPTIONS = items1;
export const getInviteChannelId = function getInviteChannelId(channelId, stateFromStores) {
if (null == stateFromStores) {
return null;
} else {
let id = null;
if (null != channelId) {
const obj = { channelId: null };
obj[0] = channelId;
const result = getUncachedChannelPermissions.canWithPartialContext(Permissions.CREATE_INSTANT_INVITE, obj);
const combined = stateFromStores[closure_3].concat(stateFromStores[closure_4]);
const found = combined.find((channel) => getUncachedChannelPermissions.can(constants.CREATE_INSTANT_INVITE, channel.channel));
if (result) {
channel = channel.getChannel(channelId);
let isThreadResult;
if (channel != null) {
isThreadResult = channel.isThread();
}
let parent_id = channelId;
if (isThreadResult) {
parent_id = channelId;
if (null != channel.parent_id) {
parent_id = channel.parent_id;
}
}
id = parent_id;
} else {
id = null;
if (null != found) {
id = found.channel.id;
}
}
const obj2 = stateFromStores[closure_3];
}
return id;
}
};
export const shouldRenderInvite = function shouldRenderInvite(channels, guild) {
let vanityURLCode;
if (guild != null) {
vanityURLCode = guild.vanityURLCode;
}
let tmp2 = null == vanityURLCode;
if (!tmp2) {
tmp2 = !f46016(f46017[5]).canViewInviteModal(getUncachedChannelPermissions, guild);
const obj = f46016(f46017[5]);
}
let tmp6 = !tmp2;
if (tmp2) {
let tmp8 = null != channels;
if (tmp8) {
let tmp10 = null != channels[closure_3].find((channel) => getUncachedChannelPermissions.can(constants.CREATE_INSTANT_INVITE, channel.channel));
if (!tmp10) {
tmp10 = null != channels[closure_4].find((channel) => getUncachedChannelPermissions.can(constants.CREATE_INSTANT_INVITE, channel.channel));
const arr2 = channels[closure_4];
}
tmp8 = tmp10;
const arr = channels[closure_3];
}
tmp6 = tmp8;
}
return tmp6;
};
export const useShouldShowInviteInActionBar = function useShouldShowInviteInActionBar(id) {
const callback = id;
const items = [closure_5];
const items1 = [id.id];
const stateFromStoresObject = callback(f46017[6]).useStateFromStoresObject(items, () => outer1_5.getChannels(id.id), items1);
let vanityURLCode;
if (id != null) {
vanityURLCode = id.vanityURLCode;
}
let tmp5 = null == vanityURLCode;
if (!tmp5) {
tmp5 = !callback(f46017[5]).canViewInviteModal(getUncachedChannelPermissions, id);
const tmpResult = callback(f46017[5]);
}
let tmp7 = !tmp5;
if (tmp5) {
let tmp8 = null == stateFromStoresObject;
if (!tmp8) {
let tmp10 = null != stateFromStoresObject[closure_3].find((channel) => getUncachedChannelPermissions.can(constants.CREATE_INSTANT_INVITE, channel.channel));
if (!tmp10) {
tmp10 = null != stateFromStoresObject[closure_4].find((channel) => getUncachedChannelPermissions.can(constants.CREATE_INSTANT_INVITE, channel.channel));
const arr4 = stateFromStoresObject[closure_4];
}
tmp8 = tmp10;
const arr3 = stateFromStoresObject[closure_3];
}
tmp7 = tmp8;
}
return tmp7;
};