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

136 lines
5.5 KiB
TypeScript

/* Metro module 12192; source: modules/billing/hooks/useFPDurationLeft.tsx; dependencies: [1244, 7054, 3826, 1216, 2] */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
function _fun93405(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#93405, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12378:6, offset: 0x020b23ea, size: 213 bytes, params: 8, frame: 19
const env0_0 = require;
const roundFPCountdownUnits2 = roundFPCountdownUnits;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
object = {SHORT_TIME_LEFT: 0};
object[0] = 'SHORT_TIME_LEFT';
object.LONG_TIME_LEFT = 1;
object[1] = 'LONG_TIME_LEFT';
object.ENDS_IN = 2;
object[2] = 'ENDS_IN';
object.SHORT_TIME = 3;
object[3] = 'SHORT_TIME';
object.CREDITS_ENDS_IN = 4;
object[4] = 'CREDITS_ENDS_IN';
(FileImportTrackerModule).fileFinishedImporting('modules/billing/hooks/useFPDurationLeft.tsx');
exports.default = useFPDurationLeft;
exports.CountDownMessageTypes = object;
exports.roundFPCountdownUnits = roundFPCountdownUnits2;
function useFPDurationLeft(a0, a1) { // fn#93407, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12378:946, offset: 0x020b263a, size: 782 bytes, params: 3, frame: 20
var object2;
var r0;
var error;
const t = require(dependencyMap[0]).t;
var property;
var moduleValue;
var unitsAsStrings;
var value6;
var captureMessage;
let value = environment;
const SHORT_TIME_LEFT = env0_3.SHORT_TIME_LEFT;
if (SHORT_TIME_LEFT === a1) {
object2 = {days: t['/wnvqA'], hours: t.Jsq0XN, minutes: t['SBd+Bs']};
} else if (env0_3.LONG_TIME_LEFT === a1) {
object2 = {days: t.UD5nn5, hours: t.Hg8Fee, minutes: t.XSbQZZ};
} else if (env0_3.ENDS_IN === a1) {
object2 = {days: t.rLqNad, hours: t.d1LvCA, minutes: t.Z2LX7K};
} else if (env0_3.CREDITS_ENDS_IN === a1) {
object2 = {days: t.xQ3zuN, hours: t.SFU7QN, minutes: t.Y4FNdL};
} else {
if (env0_3.SHORT_TIME !== a1) {
throw new global.Error('Unknown messageType (' + a1 + ') when rendering time left');
}
object2 = {days: t.fYmirx, hours: t['C3RO+g'], minutes: t.r77oHc};
}
const value4 = roundFPCountdownUnits(importDefault(dependencyMap[1])(a0.toDate(), 60000));
reducibleJoin13: while (true) {
reduciblePort20: while (true) {
exceptionLanding19: while (true) {
try {
} catch (error) {
break exceptionLanding19;
}
break reducibleJoin13;
}
value = importDefault(dependencyMap[3]);
captureMessage = value.captureMessage;
Reflect.apply(captureMessage, value, ['Error trying to format string for fractional nitro duration pill']);
r0 = '';
break reduciblePort20;
}
return r0;
}
try {
} catch (error) {
break exceptionLanding19;
}
try {
property = dependencyMap[2];
} catch (error) {
break exceptionLanding19;
}
try {
moduleValue = require(property);
} catch (error) {
break exceptionLanding19;
}
try {
unitsAsStrings = moduleValue.unitsAsStrings;
} catch (error) {
break exceptionLanding19;
}
try {
value6 = Reflect.apply(unitsAsStrings, moduleValue, [value4, object2]);
} catch (error) {
break exceptionLanding19;
}
return value6;
}
}
function roundFPCountdownUnits(a0) { // fn#93406, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12378:301, offset: 0x020b24bf, size: 379 bytes, params: 2, frame: 15
var r5;
var r1;
const object = {};
copyDataProperties(object, a0, r5);
const seconds = object.seconds;
const value = 0;
if (seconds > value) {
object.minutes = object.minutes + 1;
object.seconds = value;
}
if (object.minutes === 60) {
object.hours = object.hours + 1;
object.minutes = value;
}
if (object.hours === 24) {
object.days = object.days + 1;
object.hours = value;
}
if (object.days > value) {
return {'days': null, 'hours': 0, 'minutes': 0, 'seconds': 0,
days: object.hours > value ? object.days + 1 : object.days};
}
if (object.hours > value) {
r1 = object.minutes > 45 ? object.hours + 1 : object.hours;
return r1 > 11 ? {'days': 1, 'hours': 0, 'minutes': 0, 'seconds': 0} : {'days': 0, 'hours': null, 'minutes': 0,
'seconds': 0, hours: r1};
}
let minutes = object.minutes;
if (minutes > value) {
minutes = object.minutes;
r5 = minutes > 45 ? 1 : value;
minutes = r5 === 1 ? value : object.minutes;
return {days: value, hours: r5, minutes: minutes, seconds: value};
}
return object.seconds > value ? {'days': 0, 'hours': 0, 'minutes': 1, 'seconds': 0} : object;
}
global.__d(_fun93405, 12192, [1244, 7054, 3826, 1216,
2]) /* metro module 12192, dependencies: [1244, 7054, 3826, 1216, 2] */;