350 lines
19 KiB
TypeScript
350 lines
19 KiB
TypeScript
/* Metro module 9127; source: modules/guild_scheduled_events/useGuildScheduledEvents.tsx; dependencies: [57, 31, 1379, 1867, 3784, 4117, 9128, 1385, 661, 672, 566, 9039, 9129, 9045, 2] */
|
|
function _fun71494(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#71494, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:6, offset: 0x01d22bc8, size: 463 bytes, params: 8, frame: 20
|
|
let env0_0 = require;
|
|
const closure = function(a0) {
|
|
var env0_0 = a0;
|
|
return require(dependencyMap[10]).useStateFromStoresArray([GuildScheduledEventStore, ChannelStore,
|
|
PermissionStore],
|
|
_fun71496, [a0]);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
|
|
const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */;
|
|
let value = require(4117) /* metro dependency 4117: GuildScheduledEventStore */;
|
|
const env0_7 = value.isGuildScheduledEventActive;
|
|
const env0_8 = value.StaticGuildEventIndexes;
|
|
const guildScheduledEventStore = importDefault(4117) /* metro dependency 4117: GuildScheduledEventStore */;
|
|
const upcomingEventNoticesStore = importDefault(9128) /* metro dependency 9128: UpcomingEventNoticesStore */;
|
|
value = require(1385) /* metro dependency 1385: GuildScheduledEventsConstants */;
|
|
const env0_11 = value.GuildScheduledEventEntityTypes;
|
|
const env0_12 = value.GuildScheduledEventStatus;
|
|
value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_13 = value.GuildFeatures;
|
|
const env0_14 = value.Permissions;
|
|
const env0_15 = [];
|
|
const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
const MINUTE = Millis.MINUTE;
|
|
const env0_16 = 15 * MINUTE;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_scheduled_events/useGuildScheduledEvents.tsx');
|
|
exports.default = function(a0, a1) {
|
|
var env0_0 = a0;
|
|
var env0_1 = a1;
|
|
return require(dependencyMap[10]).useStateFromStoresArray([GuildStore, GuildScheduledEventStore,
|
|
PermissionStore,
|
|
ChannelStore], _fun71499, [a1, a0]);
|
|
};
|
|
exports.useActiveEvent = function(a0) {
|
|
var env0_0 = a0;
|
|
return require(dependencyMap[10]).useStateFromStores([GuildScheduledEventStore, ChannelStore, PermissionStore],
|
|
_fun71502, [a0]);
|
|
};
|
|
exports.useActiveEventsByChannel = useActiveEventsByChannel;
|
|
exports.useGuildUpcomingEvents = closure;
|
|
exports.useGuildUpcomingEventsNotice = useGuildUpcomingEventsNotice;
|
|
exports.useGuildActiveEvent = function(a0) {
|
|
var env0_0 = a0;
|
|
return require(dependencyMap[10]).useStateFromStores([GuildScheduledEventStore, ChannelStore, PermissionStore],
|
|
_fun71514, [a0]);
|
|
};
|
|
exports.useGuildChannelScheduledEvents = function(a0) {
|
|
var env0_0 = a0;
|
|
return require(dependencyMap[10]).useStateFromStores([GuildScheduledEventStore], _fun71517, [a0]);
|
|
};
|
|
exports.useFirstActiveEventChannel = function(a0) {
|
|
var env0_0 = a0;
|
|
return require(dependencyMap[10]).useStateFromStores([ChannelStore, GuildScheduledEventStore], _fun71519, [a0]);
|
|
};
|
|
exports.useImminentUpcomingGuildEvents = useImminentUpcomingGuildEvents;
|
|
}
|
|
|
|
function useGuildUpcomingEvents(a0) { // fn#71495, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:395, offset: 0x01d22d97, size: 92 bytes, params: 2, frame: 17
|
|
const env0_0 = a0;
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([GuildScheduledEventStore,
|
|
ChannelStore, PermissionStore], _fun71496, [a0]);
|
|
}
|
|
|
|
function useGuildEvents(a0, a1) { // fn#71498, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:821, offset: 0x01d22e9f, size: 111 bytes, params: 3, frame: 18
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([GuildStore,
|
|
GuildScheduledEventStore, PermissionStore, ChannelStore], _fun71499, [a1, a0]);
|
|
}
|
|
|
|
function useActiveEvent(a0) { // fn#71501, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:1150, offset: 0x01d22fb8, size: 91 bytes, params: 2, frame: 17
|
|
const env0_0 = a0;
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildScheduledEventStore, ChannelStore,
|
|
PermissionStore], _fun71502, [a0]);
|
|
}
|
|
|
|
function useActiveEventsByChannel(a0) { // fn#71503, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:1466, offset: 0x01d23098, size: 110 bytes, params: 2, frame: 17
|
|
const env0_0 = a0;
|
|
return env0_3.useMemo(_fun71505,
|
|
[(require(566) /* metro dependency 566: flux */).useStateFromStoresArray([GuildScheduledEventStore], _fun71504,
|
|
[a0])]);
|
|
}
|
|
|
|
function useGuildUpcomingEventsNotice(a0) { // fn#71507, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:1784, offset: 0x01d23181, size: 415 bytes, params: 2, frame: 26
|
|
var r5;
|
|
var r12;
|
|
var length;
|
|
var value9;
|
|
var property;
|
|
var id;
|
|
var property2;
|
|
var property3;
|
|
var property4;
|
|
var value10;
|
|
var moduleValue5;
|
|
var nextShownUpcomingEventNoticeType;
|
|
var value12;
|
|
const env0_0 = a0;
|
|
const value2 = useGuildUpcomingEvents(a0);
|
|
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([UpcomingEventNoticesStore],
|
|
function() {
|
|
return UpcomingEventNoticesStore.getAllEventDismissals();
|
|
});
|
|
const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([UpcomingEventNoticesStore],
|
|
function() {
|
|
return UpcomingEventNoticesStore.getAllUpcomingNoticeSeenTimes();
|
|
});
|
|
const value5 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([GuildScheduledEventStore],
|
|
_fun71510, [value2]);
|
|
const guild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], _fun71512);
|
|
if (value2 != null) {
|
|
if (value5 == null) {
|
|
return undefined;
|
|
}
|
|
if (guild != null && !guild.features.has(GuildFeatures.COMMUNITY) && guild.features.has(GuildFeatures.INTERNAL_EMPLOYEE_ONLY)) {
|
|
length = value2.length;
|
|
value9 = 0;
|
|
if (value9 < length) {
|
|
r5 = value9;
|
|
while (true) {
|
|
property = value2[r5];
|
|
id = property.id;
|
|
property2 = value3[id];
|
|
id = property.id;
|
|
property3 = value4[id];
|
|
id = property.id;
|
|
property4 = value5[id];
|
|
value10 = property4 != null;
|
|
r12 = value10 && property4;
|
|
moduleValue5 = require(9129) /* metro dependency 9129: GuildScheduledEventUtils */;
|
|
nextShownUpcomingEventNoticeType = moduleValue5.getNextShownUpcomingEventNoticeType(property,
|
|
property2,
|
|
property3,
|
|
r12);
|
|
if (nextShownUpcomingEventNoticeType != null) {
|
|
return {upcomingEvent: property, noticeType: nextShownUpcomingEventNoticeType};
|
|
}
|
|
value12 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1;
|
|
length = value2.length;
|
|
if (value12 < length) {
|
|
r5 = value12;
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
return undefined;
|
|
}
|
|
return undefined;
|
|
}
|
|
}
|
|
}
|
|
|
|
function useGuildActiveEvent(a0) { // fn#71513, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:2574, offset: 0x01d233cc, size: 91 bytes, params: 2, frame: 17
|
|
const env0_0 = a0;
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildScheduledEventStore, ChannelStore,
|
|
PermissionStore], _fun71514, [a0]);
|
|
}
|
|
|
|
function useGuildChannelScheduledEvents(a0) { // fn#71516, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:2902, offset: 0x01d234cf, size: 75 bytes, params: 2, frame: 16
|
|
const env0_0 = a0;
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildScheduledEventStore], _fun71517,
|
|
[a0]);
|
|
}
|
|
|
|
function useFirstActiveEventChannel(a0) { // fn#71518, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:3087, offset: 0x01d23544, size: 83 bytes, params: 2, frame: 17
|
|
const env0_0 = a0;
|
|
return (require(566) /* metro dependency 566: flux */).useStateFromStores([ChannelStore, GuildScheduledEventStore],
|
|
_fun71519, [a0]);
|
|
}
|
|
|
|
function useImminentUpcomingGuildEvents(a0) { // fn#71521, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:3371, offset: 0x01d23614, size: 182 bytes, params: 2, frame: 19
|
|
const env0_0 = a0;
|
|
const binding = env0_3;
|
|
const [property, env0_1] = env0_2(binding.useState(function() {
|
|
var Date = global.Date;
|
|
return Date.now();
|
|
}), 2);
|
|
binding.useEffect(_fun71523, []);
|
|
return binding.useMemo(_fun71527,
|
|
[(require(566) /* metro dependency 566: flux */).useStateFromStores([GuildScheduledEventStore], _fun71526, [a0,
|
|
property])]);
|
|
}
|
|
|
|
function _fun71496() { // fn#71496, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:479, offset: 0x01d22df3, size: 61 bytes, params: 1, frame: 13
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
const getGuildScheduledEventsByIndex = GuildScheduledEventStore.getGuildScheduledEventsByIndex;
|
|
const GUILD_EVENT_UPCOMING = StaticGuildEventIndexes.GUILD_EVENT_UPCOMING;
|
|
return Reflect.apply(getGuildScheduledEventsByIndex, GuildScheduledEventStore, [Reflect.apply(GUILD_EVENT_UPCOMING,
|
|
StaticGuildEventIndexes, [env0_0])]).filter(function(a0) {
|
|
if (a0.entity_type === GuildScheduledEventEntityTypes.NONE) {
|
|
return false;
|
|
}
|
|
if (a0.status !== GuildScheduledEventStatus.SCHEDULED) {
|
|
return false;
|
|
}
|
|
if (a0.channel_id == null) {
|
|
return true;
|
|
}
|
|
return PermissionStore.can(Permissions.VIEW_CHANNEL, ChannelStore.getChannel(a0.channel_id));
|
|
});
|
|
}
|
|
|
|
function _fun71499() { // fn#71499, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:901, offset: 0x01d22f0e, size: 107 bytes, params: 1, frame: 15
|
|
var environment;
|
|
var r0;
|
|
var getGuildScheduledEventsByIndex;
|
|
let value = environment.__proto__;
|
|
const guild = GuildStore.getGuild(env0_0);
|
|
if (guild == null) {
|
|
r0 = env1_15;
|
|
} else {
|
|
getGuildScheduledEventsByIndex = GuildScheduledEventStore.getGuildScheduledEventsByIndex;
|
|
r0 = require ?? StaticGuildEventIndexes.GUILD_EVENT_UPCOMING(guild.id);
|
|
value = Reflect.apply(getGuildScheduledEventsByIndex, GuildScheduledEventStore, [r0]);
|
|
value = value.filter(function({channel_id}) {
|
|
if (channel_id == null) {
|
|
return true;
|
|
}
|
|
return PermissionStore.can(Permissions.VIEW_CHANNEL, ChannelStore.getChannel(channel_id));
|
|
});
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _fun71502() { // fn#71502, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:1221, offset: 0x01d23013, size: 133 bytes, params: 1, frame: 15
|
|
let value = environment.__proto__;
|
|
const channel = ChannelStore.getChannel(env0_0);
|
|
const can = PermissionStore.can;
|
|
const VIEW_CHANNEL = Permissions.VIEW_CHANNEL;
|
|
const value4 = Reflect.apply(can, PermissionStore, [VIEW_CHANNEL, channel]);
|
|
const value5 = null;
|
|
if (value4) {
|
|
if (value5 == (value5 == channel ? undefined : channel.guild_id)) {
|
|
return value5;
|
|
}
|
|
value = GuildScheduledEventStore.getGuildScheduledEventsByIndex(StaticGuildEventIndexes.CHANNEL_EVENT_ACTIVE(env0_0));
|
|
return value.length > 0 ? value[0] : value5;
|
|
}
|
|
return value5;
|
|
}
|
|
|
|
function _fun71504() { // fn#71504, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:1547, offset: 0x01d23106, size: 27 bytes, params: 1, frame: 11
|
|
return GuildScheduledEventStore.getGuildScheduledEventsForGuild(env0_0);
|
|
}
|
|
|
|
function _fun71505() { // fn#71505, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:1612, offset: 0x01d23121, size: 60 bytes, params: 1, frame: 12
|
|
const Map = global.Map;
|
|
const map = new Map();
|
|
env0_1.forEach(_fun71506);
|
|
return map;
|
|
}
|
|
|
|
function _fun71510() { // fn#71510, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:2052, offset: 0x01d2334a, size: 46 bytes, params: 1, frame: 13
|
|
return env0_1 == null ? {} : env0_1.reduce(function(a0, a1) {
|
|
var value2 = require(dependencyMap[11]).getNextRecurrenceIdInEvent(a1);
|
|
var object = {};
|
|
copyDataProperties(object, a0, value2);
|
|
object[a1.id] = GuildScheduledEventStore.isInterestedInEventRecurrence(a1.id, value2);
|
|
return object;
|
|
}, {});
|
|
}
|
|
|
|
function _fun71514() { // fn#71514, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:2650, offset: 0x01d23427, size: 62 bytes, params: 1, frame: 13
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
const getGuildScheduledEventsByIndex = GuildScheduledEventStore.getGuildScheduledEventsByIndex;
|
|
const GUILD_EVENT_ACTIVE = StaticGuildEventIndexes.GUILD_EVENT_ACTIVE;
|
|
return Reflect.apply(getGuildScheduledEventsByIndex, GuildScheduledEventStore, [Reflect.apply(GUILD_EVENT_ACTIVE,
|
|
StaticGuildEventIndexes, [env0_0])]).find(function(a0) {
|
|
if (a0.entity_type !== GuildScheduledEventEntityTypes.NONE) {
|
|
if (isGuildScheduledEventActive(a0)) {
|
|
if (a0.channel_id == null) {
|
|
return true;
|
|
}
|
|
return PermissionStore.can(Permissions.VIEW_CHANNEL, ChannelStore.getChannel(a0.channel_id));
|
|
}
|
|
}
|
|
return false;
|
|
});
|
|
}
|
|
|
|
function _fun71517() { // fn#71517, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:2985, offset: 0x01d2351a, size: 42 bytes, params: 1, frame: 13
|
|
const getGuildScheduledEventsByIndex = GuildScheduledEventStore.getGuildScheduledEventsByIndex;
|
|
const CHANNEL_EVENT_UPCOMING = StaticGuildEventIndexes.CHANNEL_EVENT_UPCOMING;
|
|
return Reflect.apply(getGuildScheduledEventsByIndex, GuildScheduledEventStore,
|
|
[Reflect.apply(CHANNEL_EVENT_UPCOMING, StaticGuildEventIndexes, [env0_0])]);
|
|
}
|
|
|
|
function _fun71519() { // fn#71519, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:3168, offset: 0x01d23597, size: 92 bytes, params: 1, frame: 14
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
const getGuildScheduledEventsByIndex = GuildScheduledEventStore.getGuildScheduledEventsByIndex;
|
|
const GUILD_EVENT_ACTIVE = StaticGuildEventIndexes.GUILD_EVENT_ACTIVE;
|
|
return ChannelStore.getChannel(Reflect.apply(getGuildScheduledEventsByIndex, GuildScheduledEventStore,
|
|
[Reflect.apply(GUILD_EVENT_ACTIVE, StaticGuildEventIndexes, [env0_0])]).find(_fun71520)?.channel_id);
|
|
}
|
|
|
|
function _fun71523() { // fn#71523, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:3485, offset: 0x01d236ca, size: 45 bytes, params: 1, frame: 14
|
|
const env0_0 = global.setInterval(_fun71524, env1_16);
|
|
return _fun71525;
|
|
}
|
|
|
|
function _fun71526() { // fn#71526, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:3605, offset: 0x01d23718, size: 58 bytes, params: 1, frame: 13
|
|
return env0_0 == null ? [] : GuildScheduledEventStore.getGuildScheduledEventsByIndex(StaticGuildEventIndexes.CHANNEL_EVENT_UPCOMING(env0_0));
|
|
}
|
|
|
|
function _fun71527() { // fn#71527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:3708, offset: 0x01d23752, size: 28 bytes, params: 1, frame: 11
|
|
return env0_2.filter(_fun71528);
|
|
}
|
|
|
|
function _fun71506(a0) { // fn#71506, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:1649, offset: 0x01d2315d, size: 36 bytes, params: 2, frame: 13
|
|
const channel_id = a0.channel_id;
|
|
if (channel_id != null) {
|
|
env0_0.set(channel_id, a0);
|
|
}
|
|
}
|
|
|
|
function _fun71520({channel_id}) { // fn#71520, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:3243, offset: 0x01d235f3, size: 33 bytes, params: 2, frame: 11
|
|
const value = environment.__proto__.__proto__;
|
|
return ChannelStore.getChannel(channel_id) != null;
|
|
}
|
|
|
|
function _fun71524() { // fn#71524, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:3509, offset: 0x01d236f7, size: 33 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__;
|
|
const binding = env1_1;
|
|
const Date = global.Date;
|
|
binding(Date.now());
|
|
}
|
|
|
|
function _fun71528(a0) { // fn#71528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9312:3722, offset: 0x01d2376e, size: 153 bytes, params: 2, frame: 17
|
|
const value = environment.__proto__.__proto__;
|
|
const value2 = undefined;
|
|
const {startTime, endTime} = (require(9045) /* metro dependency 9045: useEventSchedule */).getEventSchedule(a0);
|
|
const {withinStartWindow,
|
|
diffMinutes} = (require(9039) /* metro dependency 9039: ScheduleUtils */).getEventTimeData(startTime.toISOString(),
|
|
endTime == null ? value2 : endTime.toISOString());
|
|
const status = a0.status;
|
|
const ACTIVE = GuildScheduledEventStatus.ACTIVE;
|
|
return status !== ACTIVE && withinStartWindow && diffMinutes < 15;
|
|
}
|
|
|