decord/source/modules/billing/hooks/useFPDurationLeft.tsx

112 lines
3.4 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 12948
// Function ID: 12949
2026-07-20 16:05:17 +00:00
// Name: roundFPCountdownUnits
2026-08-24 06:08:38 +00:00
// Dependencies: [1236, 7448, 4066, 1208, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 12948 (roundFPCountdownUnits)
import set from "set" /* 2 */;
import getSystemLocale from "getSystemLocale" /* 1236 */;
import useCountdownDefault from "useCountdown" /* 7448 */;
2026-07-20 16:05:17 +00:00
function roundFPCountdownUnits(arg0) {
2026-08-24 06:08:38 +00:00
obj = {};
2026-07-20 16:05:17 +00:00
const merged = Object.assign(arg0);
if (obj.seconds > 0) {
obj.minutes = obj.minutes + 1;
obj.seconds = 0;
}
if (60 === obj.minutes) {
obj.hours = obj.hours + 1;
obj.minutes = 0;
}
if (24 === obj.hours) {
obj.days = obj.days + 1;
obj.hours = 0;
}
if (obj.days > 0) {
if (obj.hours > 0) {
let days = obj.days + 1;
} else {
days = obj.days;
}
2026-07-29 08:29:29 +00:00
obj = { days: null, hours: 0, minutes: 0, seconds: 0 };
obj[0] = days;
2026-07-20 16:05:17 +00:00
return obj;
} else if (obj.hours > 0) {
if (obj.minutes > 45) {
let hours = obj.hours + 1;
} else {
hours = obj.hours;
}
if (hours > 11) {
2026-07-23 10:11:24 +00:00
obj = { days: 1, hours: 0, minutes: 0, seconds: 0 };
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj = { days: 0, hours: null, minutes: 0, seconds: 0 };
obj[1] = hours;
2026-07-20 16:05:17 +00:00
}
return obj;
} else if (obj.minutes > 0) {
let num5 = 0;
if (obj.minutes > 45) {
num5 = 1;
}
2026-08-24 06:08:38 +00:00
obj1 = { days: 0, hours: null, minutes: null, seconds: 0 };
2026-07-29 08:29:29 +00:00
obj1[1] = num5;
2026-07-20 16:05:17 +00:00
let num7 = 0;
if (1 !== num5) {
num7 = obj.minutes;
}
2026-07-29 08:29:29 +00:00
obj1[2] = num7;
2026-07-20 16:05:17 +00:00
return obj1;
} else {
let obj2 = obj;
if (obj.seconds > 0) {
2026-07-23 10:11:24 +00:00
obj2 = { days: 0, hours: 0, minutes: 1, seconds: 0 };
2026-07-20 16:05:17 +00:00
}
return obj2;
}
}
2026-07-23 10:11:24 +00:00
let obj = { SHORT_TIME_LEFT: 0, [0]: "SHORT_TIME_LEFT", LONG_TIME_LEFT: 1, [1]: "LONG_TIME_LEFT", ENDS_IN: 2, [2]: "ENDS_IN", SHORT_TIME: 3, [3]: "SHORT_TIME", CREDITS_ENDS_IN: 4, [4]: "CREDITS_ENDS_IN" };
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/billing/hooks/useFPDurationLeft.tsx");
2026-07-20 16:05:17 +00:00
export default function useFPDurationLeft(toDate) {
if (obj.SHORT_TIME_LEFT === arg1) {
2026-07-29 08:29:29 +00:00
obj = { days: null, hours: null, minutes: null };
2026-08-24 06:08:38 +00:00
obj[0] = getSystemLocale.t["/wnvqA"];
obj[1] = getSystemLocale.t.Jsq0XN;
obj[2] = getSystemLocale.t["SBd+Bs"];
2026-07-29 08:29:29 +00:00
} else if (tmp.LONG_TIME_LEFT === arg1) {
obj = { days: null, hours: null, minutes: null };
2026-08-24 06:08:38 +00:00
obj[0] = getSystemLocale.t.UD5nn5;
obj[1] = getSystemLocale.t.Hg8Fee;
obj[2] = getSystemLocale.t.XSbQZZ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
if (tmp.ENDS_IN === arg1) {
2026-08-24 06:08:38 +00:00
obj1 = { days: null, hours: null, minutes: null };
obj1[0] = getSystemLocale.t.rLqNad;
obj1[1] = getSystemLocale.t.d1LvCA;
obj1[2] = getSystemLocale.t.Z2LX7K;
2026-07-29 08:29:29 +00:00
} else if (tmp.CREDITS_ENDS_IN !== arg1) {
if (tmp.SHORT_TIME === arg1) {
obj = { days: null, hours: null, minutes: null };
2026-08-24 06:08:38 +00:00
obj[0] = getSystemLocale.t.fYmirx;
obj[1] = getSystemLocale.t["C3RO+g"];
obj[2] = getSystemLocale.t.r77oHc;
2026-07-29 08:29:29 +00:00
} else {
const _Error = Error;
const _HermesInternal = HermesInternal;
2026-08-24 06:08:38 +00:00
error = new Error("Unknown messageType (" + arg1 + ") when rendering time left");
2026-07-29 08:29:29 +00:00
throw error;
}
}
const obj2 = { days: null, hours: null, minutes: null };
2026-08-24 06:08:38 +00:00
obj2[0] = getSystemLocale.t.xQ3zuN;
obj2[1] = getSystemLocale.t.SFU7QN;
obj2[2] = getSystemLocale.t.Y4FNdL;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
roundFPCountdownUnits(useCountdownDefault(toDate.toDate(), 60000));
2026-07-20 16:05:17 +00:00
};
export const CountDownMessageTypes = obj;
export { roundFPCountdownUnits };