243 lines
12 KiB
TypeScript
243 lines
12 KiB
TypeScript
/* Metro module 5187; source: modules/parent_tools/FamilyCenterUtils.tsx; dependencies: [5116, 5117, 1244, 2224, 3738, 5118, 2] */
|
|
function _fun45681(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#45681, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:6, offset: 0x01195221, size: 376 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const familyCenterStore = importDefault(5116) /* metro dependency 5116: FamilyCenterStore */;
|
|
const familyCenterConstantsModule = require(5117) /* metro dependency 5117: FamilyCenterConstants */;
|
|
const env0_4 = familyCenterConstantsModule.ACTION_TO_TEXT;
|
|
const env0_5 = familyCenterConstantsModule.FAMILY_CENTER_ERROR_CODE_TO_FAILURE;
|
|
const env0_6 = familyCenterConstantsModule.FamilyCenterFailureCode;
|
|
const env0_7 = familyCenterConstantsModule.TeenActionDisplayType;
|
|
const env0_8 = familyCenterConstantsModule.UserLinkStatus;
|
|
const env0_9 = familyCenterConstantsModule.UserLinkType;
|
|
const closure = getActivityTypeTextConfigs;
|
|
const closure2 = hasActiveParentLinks;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/parent_tools/FamilyCenterUtils.tsx');
|
|
exports.getEmptyActivityFormatter = getEmptyActivityFormatter;
|
|
exports.getActivityWindowTimestampFormatter = getActivityWindowTimestampFormatter;
|
|
exports.formatUserActivityTimestamp = formatUserActivityTimestamp;
|
|
exports.formatLinkTimestamp = formatLinkTimestamp;
|
|
exports.isUserAction = isUserAction;
|
|
exports.isGuildAction = isGuildAction;
|
|
exports.isPurchase = function({display_type}) {
|
|
return display_type === TeenActionDisplayType.PURCHASES;
|
|
};
|
|
exports.isGift = function({display_type}) {
|
|
return display_type === TeenActionDisplayType.GIFTS;
|
|
};
|
|
exports.displayTypeFromString = displayTypeFromString;
|
|
exports.getFailureCodeForAPIError = function(a0) {
|
|
return FAMILY_CENTER_ERROR_CODE_TO_FAILURE[a0.code] ?? FamilyCenterFailureCode.GENERIC_ERROR;
|
|
};
|
|
exports.getSortedActivityTypeConfigs = getSortedActivityTypeConfigs;
|
|
exports.getActivityTypeTextConfigs = closure;
|
|
exports.formatTotalTime = function(a0) {
|
|
var Math = global.Math;
|
|
var value = Math.floor(a0 / 60);
|
|
var value2 = a0 % 60;
|
|
return value > 0 ? '' + value + 'h ' + value2 + 'm' : '' + value2 + 'm';
|
|
};
|
|
exports.getOrFetchLinkedUsers = getOrFetchLinkedUsers;
|
|
exports.hasActiveParentLinks = closure2;
|
|
exports.isParentallyControlled = function() {
|
|
return hasActiveParentLinks();
|
|
};
|
|
exports.getTopUserOrGuildDescription = getTopUserOrGuildDescription;
|
|
}
|
|
|
|
function getActivityTypeTextConfigs() { // fn#45682, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:310, offset: 0x01195399, size: 37 bytes, params: 1, frame: 11
|
|
const Map = global.Map;
|
|
const value = Object.create(Map.prototype, {constructor: {value: Map}});
|
|
const map = new Map(ACTION_TO_TEXT);
|
|
return map instanceof Object ? map : value;
|
|
}
|
|
|
|
function hasActiveParentLinks() { // fn#45683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:346, offset: 0x011953be, size: 55 bytes, params: 1, frame: 12
|
|
const Object = global.Object;
|
|
const values = Object.values;
|
|
const getLinkedUsers = FamilyCenterStore.getLinkedUsers;
|
|
return Reflect.apply(values, Object, [Reflect.apply(getLinkedUsers, FamilyCenterStore, [])]).some(_fun45684);
|
|
}
|
|
|
|
function getEmptyActivityFormatter() { // fn#45685, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:548, offset: 0x01195428, size: 141 bytes, params: 1, frame: 18
|
|
const object2 = {};
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const VjIAQQ = (importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */).VjIAQQ;
|
|
object2.today = Reflect.apply(string, intl, [VjIAQQ]);
|
|
object2.yesterday = intl.string((importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */)['2a8xHY']);
|
|
const Xt6oND = (importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */).Xt6oND;
|
|
object2.days = Xt6oND;
|
|
return object2;
|
|
}
|
|
|
|
function getActivityWindowTimestampFormatter(a0) { // fn#45686, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:705, offset: 0x011954b5, size: 241 bytes, params: 2, frame: 21
|
|
const object2 = {};
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const value = importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */;
|
|
if (a0) {
|
|
object2.today = Reflect.apply(string, intl, [value['2AtcIs']]);
|
|
object2.yesterday = intl.string((importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */).stOECr);
|
|
object2.days = (importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */).n8n5Ba;
|
|
} else {
|
|
object2.today = Reflect.apply(string, intl, [value.g1ZX6m]);
|
|
object2.yesterday = intl.string((importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */).s3qSVt);
|
|
object2.days = (importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */).f1UJiC;
|
|
}
|
|
return object2;
|
|
}
|
|
|
|
function formatUserActivityTimestamp(a0, a1, a2) { // fn#45687, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:963, offset: 0x011955a6, size: 248 bytes, params: 4, frame: 21
|
|
var r0;
|
|
var intl;
|
|
var formatToPlainString;
|
|
var days;
|
|
var object2;
|
|
var Math;
|
|
let value = a2;
|
|
const value3 = (importDefault(3738) /* metro dependency 3738 */)();
|
|
const value5 = value3.diff((importDefault(3738) /* metro dependency 3738 */)(a0), 's');
|
|
const value6 = a1();
|
|
(importDefault(3738) /* metro dependency 3738 */)(a0).format('LL');
|
|
if (value5 < 86400) {
|
|
r0 = value6.today;
|
|
} else if (value5 < 172800) {
|
|
r0 = value6.yesterday;
|
|
} else {
|
|
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
formatToPlainString = intl.formatToPlainString;
|
|
days = value6.days;
|
|
object2 = {};
|
|
Math = global.Math;
|
|
object2.days = Math.min(global.Math.floor(value5 / 86400), value ?? 999);
|
|
value = Reflect.apply(formatToPlainString, intl, [days, object2]);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function formatLinkTimestamp(a0, a1) { // fn#45688, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:1186, offset: 0x0119569e, size: 442 bytes, params: 3, frame: 23
|
|
var r0;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
var formatToPlainString;
|
|
var object2;
|
|
var days;
|
|
var hours;
|
|
var minutes;
|
|
const value2 = (importDefault(3738) /* metro dependency 3738 */)();
|
|
const value4 = value2.diff((importDefault(3738) /* metro dependency 3738 */)(a0), 's');
|
|
const value5 = a1();
|
|
if (value4 < 60) {
|
|
r0 = value5.seconds;
|
|
} else if (value4 < 3600) {
|
|
formatToPlainString = intl.formatToPlainString;
|
|
minutes = value5.minutes;
|
|
object2 = {};
|
|
object2.count = global.Math.floor(value4 / 60);
|
|
r0 = Reflect.apply(formatToPlainString, intl, [minutes, object2]);
|
|
} else if (value4 < 86400) {
|
|
formatToPlainString = intl.formatToPlainString;
|
|
hours = value5.hours;
|
|
object2 = {};
|
|
object2.count = global.Math.floor(value4 / 3600);
|
|
r0 = Reflect.apply(formatToPlainString, intl, [hours, object2]);
|
|
} else if (value4 < 172800) {
|
|
r0 = value5.yesterday;
|
|
} else if (value4 < 604800) {
|
|
formatToPlainString = intl.formatToPlainString;
|
|
days = value5.days;
|
|
object2 = {};
|
|
object2.count = global.Math.floor(value4 / 86400);
|
|
r0 = Reflect.apply(formatToPlainString, intl, [days, object2]);
|
|
} else {
|
|
r0 = intl.formatToPlainString(value5.date,
|
|
{date: (importDefault(3738) /* metro dependency 3738 */)(a0).format('LL')});
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function isUserAction(a0) { // fn#45689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:1592, offset: 0x01195858, size: 74 bytes, params: 2, frame: 5
|
|
const display_type = a0.display_type;
|
|
const USER_ADD = TeenActionDisplayType.USER_ADD;
|
|
let r0 = display_type === USER_ADD || a0.display_type === TeenActionDisplayType.USER_INTERACTION;
|
|
r0 = !r0 ? a0.display_type === TeenActionDisplayType.USER_CALLED : r0;
|
|
return r0;
|
|
}
|
|
|
|
function isGuildAction(a0) { // fn#45690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:1708, offset: 0x011958a2, size: 51 bytes, params: 2, frame: 4
|
|
const display_type = a0.display_type;
|
|
const GUILD_ADD = TeenActionDisplayType.GUILD_ADD;
|
|
return display_type === GUILD_ADD || a0.display_type === TeenActionDisplayType.GUILD_INTERACTION;
|
|
}
|
|
|
|
function displayTypeFromString(a0) { // fn#45693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:1884, offset: 0x0119590d, size: 77 bytes, params: 2, frame: 13
|
|
var r2;
|
|
var property;
|
|
var toString;
|
|
var value3;
|
|
const Object = global.Object;
|
|
const value = Object.values(TeenActionDisplayType);
|
|
let length = value.length;
|
|
const value2 = 0;
|
|
if (value2 < length) {
|
|
r2 = value2;
|
|
loopExit1: while (true) {
|
|
property = value[r2];
|
|
toString = property.toString;
|
|
if (Reflect.apply(toString, property, []) === a0) {
|
|
return property;
|
|
}
|
|
value3 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
length = value.length;
|
|
if (value3 < length) {
|
|
r2 = value3;
|
|
continue;
|
|
}
|
|
break loopExit1;
|
|
}
|
|
}
|
|
}
|
|
|
|
function getSortedActivityTypeConfigs() { // fn#45695, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:2092, offset: 0x0119597f, size: 78 bytes, params: 1, frame: 12
|
|
var r0;
|
|
var Array;
|
|
var value;
|
|
if (getActivityTypeTextConfigs().size === 0) {
|
|
r0 = [];
|
|
} else {
|
|
Array = global.Array;
|
|
value = Array.from(value.entries());
|
|
value = value.sort(function(a0, a1) {
|
|
return a0[1].priority - a1[1].priority;
|
|
});
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getOrFetchLinkedUsers() { // fn#45698, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:2387, offset: 0x01195a57, size: 72 bytes, params: 1, frame: 12
|
|
const getAreLinkedUsersProcessed = FamilyCenterStore.getAreLinkedUsersProcessed;
|
|
if (Reflect.apply(getAreLinkedUsersProcessed, FamilyCenterStore, [])) {
|
|
return FamilyCenterStore.getLinkedUsers();
|
|
}
|
|
(importDefault(5118) /* metro dependency 5118: FamilyCenterActionCreators */).fetchLinkedUsers();
|
|
}
|
|
|
|
function getTopUserOrGuildDescription(a0, a1) { // fn#45700, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:2607, offset: 0x01195a9f, size: 254 bytes, params: 3, frame: 18
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
return a1 > 0 && a0 === 0 ? intl.formatToPlainString((importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */)['L/Cj7S'],
|
|
{callCount: a1}) : a0 > 0 && a1 === 0 ? intl.formatToPlainString((importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */)['6X1F0i'],
|
|
{messageCount: a0}) : intl.formatToPlainString((importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */).IYqGMG,
|
|
{messageCount: a0, callCount: a1});
|
|
}
|
|
|
|
function _fun45684(a0) { // fn#45684, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5365:390, offset: 0x011953f5, size: 51 bytes, params: 2, frame: 4
|
|
const link_status = a0.link_status;
|
|
const value = environment.__proto__;
|
|
const ACTIVE = UserLinkStatus.ACTIVE;
|
|
return link_status === ACTIVE && a0.link_type === UserLinkType.PARENT;
|
|
}
|
|
|