Files
discord-decomp/sources/modules/parent_tools/FamilyCenterRestrictedHoursUtils.tsx
2026-07-28 01:06:53 +03:00

387 lines
17 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* Metro module 10909; source: modules/parent_tools/FamilyCenterRestrictedHoursUtils.tsx; dependencies: [1895, 1244, 2224, 2] */
import FamilyCenterMessages from './FamilyCenter.messages.js'; /* Metro dependency 2224 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as UserModule from '../../external/discord_common/js/packages/protos/discord_protos/users/v1/user.tsx'; /* Metro dependency 1895 */
function _fun83587(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#83587, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:6, offset: 0x01f1f5b1, size: 593 bytes, params: 8, frame: 26
let env0_0 = require;
const _arrayLikeToArray_83590 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const formatTime_835912 = formatTime_83591;
const formatDays2 = formatDays;
const closure3 = function(a0) {
return 60 * a0.hours + a0.minutes;
};
const getScheduleRuleDateRange2 = getScheduleRuleDateRange;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const DayOfWeek = (UserModule).DayOfWeek;
const SUNDAY = DayOfWeek.SUNDAY;
items2 = [SUNDAY];
const MONDAY = DayOfWeek.MONDAY;
items2[1] = MONDAY;
const TUESDAY = DayOfWeek.TUESDAY;
items2[2] = TUESDAY;
const WEDNESDAY = DayOfWeek.WEDNESDAY;
items2[3] = WEDNESDAY;
const THURSDAY = DayOfWeek.THURSDAY;
items2[4] = THURSDAY;
const FRIDAY = DayOfWeek.FRIDAY;
items2[5] = FRIDAY;
const SATURDAY = DayOfWeek.SATURDAY;
items2[6] = SATURDAY;
let Set = global.Set;
let set = new Set(items2.slice(1, 6));
Set = global.Set;
set = new Set([items2[0], items2[6]]);
Set = global.Set;
set = new Set(items2);
(FileImportTrackerModule).fileFinishedImporting('modules/parent_tools/FamilyCenterRestrictedHoursUtils.tsx');
exports.DAYS_ORDERED = items2;
exports.getShortDayLabels = getShortDayLabels;
exports.formatTime = formatTime_835912;
exports.formatDays = formatDays2;
exports.timeToMinutes = closure3;
exports.formatDuration = formatDuration_83600;
exports.getScheduleRuleDateRange = getScheduleRuleDateRange2;
exports.formatRestrictedScheduleInAppSubtitle = formatRestrictedScheduleInAppSubtitle;
exports.sortRulesByStartTime = function(a0) {
return a0.slice().sort(_fun83603);
};
exports.toTimeProto = function(a0) {
return {hours: a0.hours, minutes: a0.minutes, seconds: 0, nanos: 0};
};
exports.computeOverlappingInfo = function(a0, a1, a2) {
var env0_0 = a0;
var env0_1 = a1;
var env0_2 = a2;
var items = [];
items.forEach(_fun83606);
return {conflictingEntries: items};
};
function _createForOfIteratorHelperLoose_83588(a0, a1) { // fn#83588, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:47, offset: 0x01f1f802, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun83589;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_83590(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_83590(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_83590(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun83589;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _fun83589() { // fn#83589, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:618, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function formatTime_83591({hours, minutes}) { // fn#83591, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:1205, offset: 0x01f1f976, size: 148 bytes, params: 2, frame: 21
const Intl = global.Intl;
const DateTimeFormat = Intl.DateTimeFormat;
const dateTimeFormat = new DateTimeFormat((IndexNativeModule).intl.currentLocale,
{'hour': 'numeric', 'minute': '2-digit'});
const format = dateTimeFormat.format;
const Date = global.Date;
const value2 = Object.create(Date.prototype, {constructor: {value: Date}});
const date = new Date(2025, 0, 1, hours, minutes);
return Reflect.apply(format, dateTimeFormat, [date instanceof Object ? date : value2]);
}
function setsEqual(a0, a1) { // fn#83592, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:1431, offset: 0x01f1fa0a, size: 91 bytes, params: 3, frame: 14
var value3;
var has;
var value4;
if (a0.size === a1.size) {
var value;
value = _createForOfIteratorHelperLoose_83588(a0);
var value2 = value();
var done = value2.done;
if (done) {
return true;
}
var r1 = value2;
loopExit2: while (true) {
value3 = r1.value;
has = a1.has;
if (Reflect.apply(has, a1, [value3])) {
value4 = value();
done = value4.done;
if (done) {
return true;
}
r1 = value4;
continue;
}
break loopExit2;
}
}
return false;
}
function formatDays(a0) { // fn#83593, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:1591, offset: 0x01f1fa65, size: 422 bytes, params: 2, frame: 16
const intl = (IndexNativeModule).intl;
const Set = global.Set;
const set = new Set(a0);
if (setsEqual(set, env0_6)) {
return intl.string((importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */).bPjqd1);
}
if (setsEqual(set, env0_4)) {
return intl.string((importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */)['4dr9L9']);
}
if (setsEqual(set, env0_5)) {
return intl.string((importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */)['6lTTJ+']);
}
const Intl = global.Intl;
const DateTimeFormat = Intl.DateTimeFormat;
let dateTimeFormat = new DateTimeFormat(intl.currentLocale, {weekday: 'short'});
dateTimeFormat = env0_3.map(_fun83594);
dateTimeFormat = dateTimeFormat.filter(function(a0) {
return a0 !== null;
});
return dateTimeFormat.join(', ');
function _fun83594(a0, a1) { // fn#83594, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:1917, offset: 0x01f1fc0b, size: 87 bytes, params: 3, frame: 18
var r0;
var format;
var Date;
var date;
var value;
let binding = env0_0;
if (binding.has(a0)) {
binding = env0_1;
format = binding.format;
Date = global.Date;
value = 5 + a1;
date = new Date(2025, 0);
date = Reflect.apply(format, binding, [date]);
r0 = date;
} else {
r0 = null;
}
return r0;
}
}
function getScheduleRuleDateRange(a0) { // fn#83597, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:2058, offset: 0x01f1fc62, size: 100 bytes, params: 2, frame: 16
var r0;
var formatTime_83591Binding;
const startTime = a0.startTime;
let value = '';
if (startTime != null) {
if (a0.endTime != null) {
formatTime_83591Binding = formatTime_83591;
value = value + formatTime_83591Binding(a0.startTime) + ' – ' + formatTime_83591Binding(a0.endTime);
r0 = value;
} else {
r0 = value;
}
} else {
r0 = value;
}
return r0;
}
function getShortDayLabels(a0) { // fn#83598, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:2329, offset: 0x01f1fcc6, size: 112 bytes, params: 2, frame: 15
const Intl = global.Intl;
const DateTimeFormat = Intl.DateTimeFormat;
const dateTimeFormat = new DateTimeFormat((IndexNativeModule).intl.currentLocale,
{weekday: a0});
return env0_3.map(_fun83599);
function _fun83599(a0, a1) { // fn#83599, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:2444, offset: 0x01f1fd36, size: 65 bytes, params: 3, frame: 17
const binding = env0_0;
const format = binding.format;
const Date = global.Date;
const value = 5 + a1;
const value2 = Object.create(Date.prototype, {constructor: {value: Date}});
const date = new Date(2025, 0);
return Reflect.apply(format, binding, [date instanceof Object ? date : value2]);
}
}
function formatDuration_83600(a0) { // fn#83600, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:2584, offset: 0x01f1fd77, size: 146 bytes, params: 2, frame: 18
var r0;
var wcrXLM;
var object;
let value = a0 / 60;
const Number = global.Number;
const isInteger2 = Number.isInteger(value);
const intl = (IndexNativeModule).intl;
const formatToPlainString = intl.formatToPlainString;
const defaultImport = FamilyCenterMessages;
if (isInteger2) {
value = Reflect.apply(formatToPlainString, intl, [defaultImport.hFDcmZ, {hours: value}]);
r0 = value;
} else {
wcrXLM = defaultImport.wcrXLM;
object = {};
object.hours = global.Math.floor(value);
value = Reflect.apply(formatToPlainString, intl, [wcrXLM, object]);
r0 = value;
}
return r0;
}
function formatRestrictedScheduleInAppSubtitle(a0) { // fn#83601, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:2878, offset: 0x01f1fe09, size: 222 bytes, params: 2, frame: 19
if (a0.startTime == null) {
return null;
}
if (a0.endTime == null) {
return null;
}
const value2 = formatDays(a0.days);
const formatTime_83591Binding = formatTime_83591;
const value3 = formatTime_83591Binding(a0.startTime);
const value4 = formatTime_83591Binding(a0.endTime);
const timeToMinutesBinding = timeToMinutes;
const r4 = timeToMinutesBinding(a0.startTime) > timeToMinutesBinding(a0.endTime) ? (importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */).OxveI8 : (importDefault(2224) /* metro dependency 2224: FamilyCenterMessages */)['ERTn+E'];
const intl = (IndexNativeModule).intl;
return intl.formatToPlainString(r4, {days: value2, startTime: value3, endTime: value4});
}
function sortRulesByStartTime(a0) { // fn#83602, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:3242, offset: 0x01f1fee7, size: 34 bytes, params: 2, frame: 11
return a0.slice().sort(_fun83603);
}
function computeOverlappingInfo(a0, a1, a2) { // fn#83605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:3685, offset: 0x01f1ffd7, size: 64 bytes, params: 4, frame: 12
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a2;
const items2 = [];
items2.forEach(_fun83606);
return {conflictingEntries: items2};
function _fun83606(a0, a1) { // fn#83606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:3751, offset: 0x01f20017, size: 112 bytes, params: 3, frame: 14
var environment;
var value2;
var push;
var object;
let binding = a0;
if (binding.has(a0)) {
value2 = require.find(_fun83607);
if (value2 != null) {
binding = env0_3;
push = binding.push;
object = {};
object.dayLabel = importDefault[a1];
value = environment.__proto__;
object.timeRange = getScheduleRuleDateRange(value2);
Reflect.apply(push, binding, [object]);
}
}
function _fun83607({days}) { // fn#83607, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:3786, offset: 0x01f20087, size: 28 bytes, params: 2, frame: 11
return days.includes(env0_0);
}
}
}
}
function _fun83603(a0, a1) { // fn#83603, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11095:3298, offset: 0x01f1ff09, size: 165 bytes, params: 3, frame: 9
let startTime = a0.startTime;
const value = undefined;
const hours = startTime == null ? value : startTime.hours;
const value2 = 0;
const value3 = 60 * (hours ?? value2);
startTime = a0.startTime;
const value4 = value3 + ((startTime == null ? value : startTime.minutes) ?? value2);
startTime = a1.startTime;
const value5 = 60 * ((startTime == null ? value : startTime.hours) ?? value2);
startTime = a1.startTime;
return value4 - (value5 + ((startTime == null ? value : startTime.minutes) ?? value2));
}
global.__d(_fun83587, 10909, [1895, 1244, 2224, 2]) /* metro module 10909, dependencies: [1895, 1244, 2224, 2] */;