119 lines
6.6 KiB
TypeScript
119 lines
6.6 KiB
TypeScript
/* Metro module 10247; source: modules/user_profile/hooks/useActivityTimer.tsx; dependencies: [57, 31, 672, 8375, 4041, 2] */
|
|
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import Durations from '../../../utils/Durations.tsx'; /* Metro dependency 672 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as TimersModule from '../../../external/discord_common/js/packages/timers/Timers.tsx'; /* Metro dependency 4041 */
|
|
import * as UtilsModule from '../../content_inventory/utils.tsx'; /* Metro dependency 8375 */
|
|
|
|
function _fun79580(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#79580, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:6, offset: 0x01e58fbb, size: 198 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const pad_79582 = function(a0) {
|
|
return (0, global.String)(a0).padStart(2, '0');
|
|
};
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/user_profile/hooks/useActivityTimer.tsx');
|
|
exports.default = useActivityTimer;
|
|
exports.formatTime = formatTime_79588;
|
|
exports.formatTimeForA11yLabel = formatTimeForA11yLabel;
|
|
function extractTimeComponents(a0) { // fn#79581, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:165, offset: 0x01e59081, size: 191 bytes, params: 2, frame: 18
|
|
let Math = global.Math;
|
|
let floor = Math.floor;
|
|
let value = Reflect.apply(floor, Math, [a0]);
|
|
let Seconds = (importDefault(672) /* metro dependency 672: Durations */).Seconds;
|
|
let MINUTE = Seconds.MINUTE;
|
|
value %= MINUTE;
|
|
Math = global.Math;
|
|
floor = Math.floor;
|
|
Seconds = (importDefault(672) /* metro dependency 672: Durations */).Seconds;
|
|
MINUTE = Seconds.MINUTE;
|
|
const value3 = Reflect.apply(floor, Math, [a0 / MINUTE]);
|
|
Seconds = (importDefault(672) /* metro dependency 672: Durations */).Seconds;
|
|
MINUTE = Seconds.MINUTE;
|
|
const value4 = value3 % MINUTE;
|
|
Math = global.Math;
|
|
floor = Math.floor;
|
|
Seconds = (importDefault(672) /* metro dependency 672: Durations */).Seconds;
|
|
const HOUR = Seconds.HOUR;
|
|
return {hours: Reflect.apply(floor, Math, [a0 / HOUR]), minutes: value4, seconds: value};
|
|
}
|
|
|
|
function useActivityTimer({start, end}) { // fn#79583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:468, offset: 0x01e59140, size: 310 bytes, params: 2, frame: 23
|
|
const Interval = (TimersModule).Interval;
|
|
const value2 = Object.create(Interval.prototype, {constructor: {value: Interval}});
|
|
const interval = new Interval();
|
|
const value4 = useState(interval instanceof Object ? interval : value2);
|
|
const property = Module00057(value4, 1)[0];
|
|
const [property2, env0_1] = Module00057(useState(function() {
|
|
var Date = global.Date;
|
|
return Date.now();
|
|
}), 2);
|
|
useEffect(_fun79585, [property]);
|
|
const value8 = end - start;
|
|
let Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
let SECOND = Millis.SECOND;
|
|
const value = value8 / SECOND;
|
|
let Math = global.Math;
|
|
let max = Math.max;
|
|
const Math2 = global.Math;
|
|
const min = Math2.min;
|
|
const value9 = property2 - start;
|
|
Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
SECOND = Millis.SECOND;
|
|
const value10 = Reflect.apply(max, Math, [Reflect.apply(min, Math2, [value9 / SECOND, value]), 0]);
|
|
Math = global.Math;
|
|
max = Math.max;
|
|
const Math3 = global.Math;
|
|
return {elapsed: value10, duration: value, percentage: Reflect.apply(max, Math, [Math3.min(value10 / value, 1), 0])};
|
|
function _fun79585() { // fn#79585, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:602, offset: 0x01e59276, size: 73 bytes, params: 1, frame: 15
|
|
const binding = env0_0;
|
|
const start = binding.start;
|
|
const Millis = (Durations).Millis;
|
|
const HALF_SECOND = Millis.HALF_SECOND;
|
|
Reflect.apply(start, binding, [HALF_SECOND, _fun79586]);
|
|
return _fun79587;
|
|
function _fun79586() { // fn#79586, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:643, offset: 0x01e592bf, size: 33 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__;
|
|
const binding = env1_1;
|
|
const Date = global.Date;
|
|
return binding(Date.now());
|
|
}
|
|
|
|
function _fun79587() { // fn#79587, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:663, offset: 0x01e592e0, size: 19 bytes, params: 1, frame: 9
|
|
return env1_0.stop();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function formatTime_79588(a0) { // fn#79588, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:853, offset: 0x01e592f3, size: 140 bytes, params: 2, frame: 22
|
|
var r0;
|
|
var pad_79582Binding;
|
|
var value;
|
|
const {hours, minutes, seconds} = extractTimeComponents(a0);
|
|
if (hours === 0) {
|
|
pad_79582Binding = pad_79582;
|
|
value = pad_79582Binding(minutes);
|
|
value = '' + value + ':' + pad_79582Binding(seconds);
|
|
r0 = value;
|
|
} else {
|
|
pad_79582Binding = pad_79582;
|
|
value = pad_79582Binding(hours);
|
|
value = '' + value + ':' + pad_79582Binding(minutes) + ':' + pad_79582Binding(seconds);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function formatTimeForA11yLabel(a0) { // fn#79589, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10433:1015, offset: 0x01e5937f, size: 85 bytes, params: 2, frame: 15
|
|
const {hours, minutes, seconds} = extractTimeComponents(a0);
|
|
return UtilsModule.formatTimestampToA11yLabel({hours: hours, minutes: minutes, seconds: seconds});
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun79580, 10247, [57, 31, 672, 8375, 4041,
|
|
2]) /* metro module 10247, dependencies: [57, 31, 672, 8375, 4041, 2] */;
|