decord/source/modules/guild_scheduled_events/useEventSchedule.tsx

121 lines
4.5 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 8828
// Function ID: 8829
2026-07-29 08:29:29 +00:00
// Name: useEventSchedule
2026-08-24 06:08:38 +00:00
// Dependencies: [4374, 8822, 8827, 589, 2]
2026-07-20 16:05:17 +00:00
// Exports: default, getEventSchedule, useEventScheduleById
2026-08-24 06:08:38 +00:00
// Module 8828 (useEventSchedule)
import getRRule from "getRRule" /* 8822 */;
import useEventException from "useEventException" /* 8827 */;
import useEventExceptionDefault from "useEventException" /* 8827 */;
import closure_3 from "scheduledEventSort" /* 4374 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
const result = require("set").fileFinishedImporting("modules/guild_scheduled_events/useEventSchedule.tsx");
2026-07-29 08:29:29 +00:00
export default function useEventSchedule(recurrence_rule, nextRecurrenceIdInEvent) {
if (nextRecurrenceIdInEvent == null) {
2026-08-24 06:08:38 +00:00
let obj = getRRule;
2026-07-29 08:29:29 +00:00
nextRecurrenceIdInEvent = obj.getNextRecurrenceIdInEvent(recurrence_rule);
}
if (null != recurrence_rule.recurrence_rule) {
2026-07-20 16:05:17 +00:00
if (null != nextRecurrenceIdInEvent) {
2026-08-24 06:08:38 +00:00
const baseScheduleForRecurrence = getRRule.getBaseScheduleForRecurrence(nextRecurrenceIdInEvent, recurrence_rule);
const obj2 = getRRule;
const scheduleForRecurrenceWithException = getRRule.getScheduleForRecurrenceWithException(baseScheduleForRecurrence, tmp5);
2026-07-20 16:05:17 +00:00
({ startDate, endDate } = scheduleForRecurrenceWithException);
2026-07-29 08:29:29 +00:00
obj = { startTime: null, endTime: null };
obj[0] = startDate.toDate();
let toDateResult;
if (endDate != null) {
2026-07-20 16:05:17 +00:00
toDateResult = endDate.toDate();
}
2026-07-29 08:29:29 +00:00
obj[1] = toDateResult;
2026-08-24 06:08:38 +00:00
const obj3 = getRRule;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return obj;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
obj = { startTime: new Date(recurrence_rule.scheduled_start_time), endTime: null };
2026-07-20 16:05:17 +00:00
let date1 = null;
2026-07-29 08:29:29 +00:00
if (null != recurrence_rule.scheduled_end_time) {
2026-07-20 16:05:17 +00:00
const _Date = Date;
2026-07-29 08:29:29 +00:00
date1 = new Date(recurrence_rule.scheduled_end_time);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = date1;
2026-07-20 16:05:17 +00:00
};
export const useEventScheduleById = function useEventScheduleById(guildEventId, recurrenceId) {
2026-07-23 10:11:24 +00:00
const _require = guildEventId;
2026-07-29 08:29:29 +00:00
let nextRecurrenceIdInEvent = recurrenceId;
let obj = _require(589);
2026-08-24 06:08:38 +00:00
const items = [closure_3];
let stateFromStores = obj.useStateFromStores(items, () => closure_1_3.getGuildScheduledEvent(closure_0));
2026-07-29 08:29:29 +00:00
let tmp5 = null;
if (recurrenceId == null) {
2026-08-24 06:08:38 +00:00
let tmp2Result = tmp2(8822);
2026-07-29 08:29:29 +00:00
nextRecurrenceIdInEvent = tmp2Result.getNextRecurrenceIdInEvent(stateFromStores);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
useEventExceptionDefault;
2026-07-29 08:29:29 +00:00
if (stateFromStores != tmp5) {
2026-07-20 16:05:17 +00:00
const id = stateFromStores.id;
}
2026-07-29 08:29:29 +00:00
if (tmp5 == stateFromStores) {
return null;
} else {
if (tmp5 != stateFromStores.recurrence_rule) {
if (tmp5 != nextRecurrenceIdInEvent) {
2026-08-24 06:08:38 +00:00
tmp2Result = tmp2(8822);
2026-07-29 08:29:29 +00:00
const baseScheduleForRecurrence = tmp2Result.getBaseScheduleForRecurrence(nextRecurrenceIdInEvent, stateFromStores);
2026-08-24 06:08:38 +00:00
const scheduleForRecurrenceWithException = tmp2(8822).getScheduleForRecurrenceWithException(baseScheduleForRecurrence, tmp7);
2026-07-29 08:29:29 +00:00
({ startDate, endDate } = scheduleForRecurrenceWithException);
obj = { startTime: null, endTime: null };
obj[0] = startDate.toDate();
let toDateResult;
if (endDate != tmp5) {
toDateResult = endDate.toDate();
}
obj[1] = toDateResult;
2026-08-24 06:08:38 +00:00
const tmp2Result1 = tmp2(8822);
2026-07-29 08:29:29 +00:00
}
}
obj = { startTime: null, endTime: null };
const _Date = Date;
const date = new Date(stateFromStores.scheduled_start_time);
obj[0] = date;
tmp5 = null;
if (tmp16) {
const _Date2 = Date;
stateFromStores = new Date(stateFromStores.scheduled_end_time);
tmp5 = stateFromStores;
}
obj[1] = tmp5;
tmp16 = tmp5 != stateFromStores.scheduled_end_time;
2026-07-20 16:05:17 +00:00
}
};
export const getEventSchedule = function getEventSchedule(guildEvent, recurrenceId) {
2026-08-24 06:08:38 +00:00
useEventException;
2026-07-29 08:29:29 +00:00
if (null != guildEvent.recurrence_rule) {
if (null != recurrenceId) {
2026-08-24 06:08:38 +00:00
let tmpResult = tmp(8822);
2026-07-29 08:29:29 +00:00
const baseScheduleForRecurrence = tmpResult.getBaseScheduleForRecurrence(recurrenceId, guildEvent);
2026-08-24 06:08:38 +00:00
tmpResult = tmp(8822);
2026-07-29 08:29:29 +00:00
const scheduleForRecurrenceWithException = tmpResult.getScheduleForRecurrenceWithException(baseScheduleForRecurrence, tmp4);
({ startDate, endDate } = scheduleForRecurrenceWithException);
let obj = { startTime: null, endTime: null };
obj[0] = startDate.toDate();
let toDateResult;
if (endDate != null) {
toDateResult = endDate.toDate();
}
obj[1] = toDateResult;
}
return obj;
}
2026-08-24 06:08:38 +00:00
obj = { startTime: new Date(guildEvent.scheduled_start_time), endTime: null };
2026-07-29 08:29:29 +00:00
let date1 = null;
if (null != guildEvent.scheduled_end_time) {
const _Date = Date;
date1 = new Date(guildEvent.scheduled_end_time);
}
obj[1] = date1;
2026-07-20 16:05:17 +00:00
};