302 lines
13 KiB
TypeScript
302 lines
13 KiB
TypeScript
/* Metro module 15688; source: modules/dice_roll/DiceRollLifecycleManager.tsx; dependencies: [6, 7, 15, 17, 18, 1379, 1934, 11526, 7872, 4503, 1244, 7067, 7076, 4860, 2] */
|
|
function _fun120356(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120356, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:6, offset: 0x02528ebf, size: 391 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_4 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_5 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_6 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_7 = importDefault(18) /* metro dependency 18 */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
|
|
const diceRollStore = importDefault(11526) /* metro dependency 11526: DiceRollStore */;
|
|
const env0_11 = (require(11526) /* metro dependency 11526: DiceRollStore */).INITIAL_STATE;
|
|
let value = require(7872) /* metro dependency 7872: DiceRollConstants */;
|
|
const env0_12 = value.AFTER_ROLL_DELAY_MS;
|
|
const env0_13 = value.ALLOWED_DICE_SIDES_SET;
|
|
const env0_14 = value.DEFAULT_DICE_SIDES;
|
|
const env0_15 = value.DISMISS_DELAY_MS;
|
|
const env0_16 = value.MAX_DICE_COUNT;
|
|
const env0_17 = value.ROLL_DURATION_MS;
|
|
const env0_18 = (require(4503) /* metro dependency 4503: MessageConstants */).MessageSendLocation;
|
|
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
|
|
value = _fun120360(value);
|
|
value = new value();
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/dice_roll/DiceRollLifecycleManager.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_120357() { // fn#120357, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:387, offset: 0x02529046, size: 98 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_120357_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun120360(a0) { // fn#120360, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:590, offset: 0x025290a8, size: 151 bytes, params: 2, frame: 16
|
|
const closure = DiceRollLifecycleManager;
|
|
env0_7(closure, a0);
|
|
return env0_4(closure, [{key: 'finishRoll', value: function(a0, a1, a2, a3) {
|
|
var env0_0 = this;
|
|
DiceRollStore.setState({rolling: false, results: a3});
|
|
this.postRollDismissTimer = global.setTimeout(_fun120368, AFTER_ROLL_DELAY_MS);
|
|
this.sendMessage(a0, a1, a2, a3);
|
|
}}, {key: 'sendMessage', value: value_120369}, {key: 'dismiss', value: function() {
|
|
var env0_0 = this;
|
|
DiceRollStore.setState({dismissing: true});
|
|
this.collapseTimer = global.setTimeout(_fun120373, DISMISS_DELAY_MS);
|
|
}}, {key: 'clearTimers', value: function() {
|
|
if (this.rollTimer != null) {
|
|
global.clearTimeout(this.rollTimer);
|
|
this.rollTimer = null;
|
|
}
|
|
if (this.postRollDismissTimer != null) {
|
|
global.clearTimeout(this.postRollDismissTimer);
|
|
this.postRollDismissTimer = null;
|
|
}
|
|
if (this.collapseTimer != null) {
|
|
global.clearTimeout(this.collapseTimer);
|
|
this.collapseTimer = null;
|
|
}
|
|
}}]);
|
|
}
|
|
|
|
function DiceRollLifecycleManager(a0) { // fn#120361, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:602, offset: 0x0252913f, size: 212 bytes, params: 2, frame: 20
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_3;
|
|
binding(this, DiceRollLifecycleManager);
|
|
const items = [];
|
|
arraySpread(items, value, 0, items);
|
|
value = env1_6(DiceRollLifecycleManager);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_120357()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.actions = {CHANNEL_SELECT: CHANNEL_SELECT_120362, DICE_ROLL_START: DICE_ROLL_START};
|
|
value.rollTimer = null;
|
|
value.postRollDismissTimer = null;
|
|
value.collapseTimer = null;
|
|
value.handleChannelSelect = handleChannelSelect_120364;
|
|
value.handleStartRoll = handleStartRoll;
|
|
return value;
|
|
}
|
|
|
|
function value_120367(a0, a1, a2, a3) { // fn#120367, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:1626, offset: 0x02529414, size: 104 bytes, params: 5, frame: 19
|
|
DiceRollStore.setState({rolling: false, results: a3});
|
|
this.postRollDismissTimer = global.setTimeout(_fun120368, AFTER_ROLL_DELAY_MS);
|
|
this.sendMessage(a0, a1, a2, a3);
|
|
}
|
|
|
|
function value_120369(a0, a1, a2, a3) { // fn#120369, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:1826, offset: 0x02529499, size: 548 bytes, params: 5, frame: 35
|
|
var r6;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
var value7;
|
|
var value9;
|
|
var defaultImport;
|
|
const channel = ChannelStore.getChannel(a0);
|
|
if (channel != null) {
|
|
value7 = '[`' + intl.formatToPlainString(t.uV5JaG, {count: a1,
|
|
sides: a2}) + '`](' + ('' + global.location.protocol + global.window.GLOBAL_ENV.WEBAPP_ENDPOINT + '/channels/' + (channel.getGuildId() ?? '@me') + '/' + a0 + '/roll-dice/' + a1 + 'd' + a2) + ')';
|
|
value9 = intl.formatToMarkdownString(t.tmSbYW, {total: a3.reduce(function(a0, a1) {
|
|
return a0 + a1;
|
|
}, 0), count: a1, sides: a2});
|
|
r6 = a1 === 1 ? '### ' + value9 + ' ' + value7 : '### ' + value9 + ' ' + value7 + '\n' + ('-# ' + a3.map(_fun120371).join(' '));
|
|
defaultImport = importDefault(7067) /* metro dependency 7067: MessageActionCreators */;
|
|
defaultImport.sendMessage(a0, (importDefault(7076) /* metro dependency 7076: MessageParser */).parse(channel,
|
|
r6),
|
|
true, {location: MessageSendLocation.CHAT_INPUT});
|
|
}
|
|
}
|
|
|
|
function value_120372() { // fn#120372, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:2424, offset: 0x025296e3, size: 71 bytes, params: 1, frame: 16
|
|
DiceRollStore.setState({dismissing: true});
|
|
this.collapseTimer = global.setTimeout(_fun120373, DISMISS_DELAY_MS);
|
|
}
|
|
|
|
function DICE_ROLL_START(a0) { // fn#120363, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:930, owner: DiceRollLifecycleManager.DICE_ROLL_START, offset: 0x02529213, size: 23 bytes, params: 2, frame: 11
|
|
return env0_0.handleStartRoll(a0);
|
|
}
|
|
|
|
function DiceRollLifecycleManagerHandleChannelSelect({channelId}) { // fn#120364, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:1043, owner: DiceRollLifecycleManager.handleChannelSelect, offset: 0x0252922a, size: 84 bytes, params: 2, frame: 11
|
|
var binding;
|
|
let value = environment.__proto__.__proto__;
|
|
value = DiceRollStore.getState();
|
|
if (value.channelId != null && value.channelId !== channelId) {
|
|
binding = env0_0;
|
|
binding.clearTimers();
|
|
binding.dismiss();
|
|
}
|
|
}
|
|
|
|
function handleStartRoll({channelId, diceCount, diceSides}) { // fn#120365, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:1165, owner: DiceRollLifecycleManager.handleStartRoll, offset: 0x0252927e, size: 353 bytes, params: 2, frame: 23
|
|
var environment;
|
|
var r4;
|
|
var r8;
|
|
var r7;
|
|
var r5;
|
|
var value;
|
|
var getState;
|
|
var channelId2;
|
|
var value2;
|
|
var Math;
|
|
var min;
|
|
var Math2;
|
|
var max;
|
|
var value3;
|
|
var value4;
|
|
var has;
|
|
var setState;
|
|
var items;
|
|
var value5;
|
|
var push;
|
|
var floor;
|
|
var Math3;
|
|
var random;
|
|
var value6;
|
|
var value7;
|
|
var binding;
|
|
var setTimeout;
|
|
const env0_0 = channelId;
|
|
reducibleJoin2: while (true) {
|
|
if (diceCount !== undefined) {
|
|
break reducibleJoin2;
|
|
}
|
|
value = 1;
|
|
diceCount = value;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (diceSides !== undefined) {
|
|
r4 = diceSides;
|
|
break reducibleJoin4;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
r4 = DEFAULT_DICE_SIDES;
|
|
break reducibleJoin4;
|
|
}
|
|
var env0_1;
|
|
var env0_2;
|
|
var env0_3;
|
|
value = environment.__proto__.__proto__;
|
|
const getChannelId = SelectedChannelStore.getChannelId;
|
|
reducibleJoin13: while (true) {
|
|
if (Reflect.apply(getChannelId, SelectedChannelStore, []) !== channelId) {
|
|
break reducibleJoin13;
|
|
}
|
|
getState = DiceRollStore.getState;
|
|
channelId2 = Reflect.apply(getState, DiceRollStore, []).channelId;
|
|
if (channelId2 != null) {
|
|
break reducibleJoin13;
|
|
}
|
|
value2 = 42;
|
|
reducibleJoin8: while (true) {
|
|
if (value2 === diceCount) {
|
|
r8 = value2;
|
|
break reducibleJoin8;
|
|
}
|
|
Math = global.Math;
|
|
min = Math.min;
|
|
Math2 = global.Math;
|
|
max = Math2.max;
|
|
value3 = Reflect.apply(max, Math2, [diceCount, 1]);
|
|
value4 = Reflect.apply(min, Math, [value3, MAX_DICE_COUNT]);
|
|
r8 = value4;
|
|
break reducibleJoin8;
|
|
}
|
|
env0_1 = r8;
|
|
has = ALLOWED_DICE_SIDES_SET.has;
|
|
reducibleJoin10: while (true) {
|
|
if (Reflect.apply(has, ALLOWED_DICE_SIDES_SET, [r4])) {
|
|
r7 = r4;
|
|
break reducibleJoin10;
|
|
}
|
|
r7 = DEFAULT_DICE_SIDES;
|
|
break reducibleJoin10;
|
|
}
|
|
env0_2 = r7;
|
|
setState = DiceRollStore.setState;
|
|
Reflect.apply(setState, DiceRollStore, [{channelId: channelId, rolling: true, diceCount: r8, diceSides: r7,
|
|
results: null}]);
|
|
items = [];
|
|
env0_3 = items;
|
|
value5 = 0;
|
|
if (value5 < r8) {
|
|
r5 = value5;
|
|
reducibleLoop11: while (true) {
|
|
push = items.push;
|
|
Math = global.Math;
|
|
floor = Math.floor;
|
|
Math3 = global.Math;
|
|
random = Math3.random;
|
|
Reflect.apply(push, items, [Reflect.apply(floor, Math, [Reflect.apply(random, Math3, []) * r7]) + 1]);
|
|
value6 = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1;
|
|
if (value6 < r8) {
|
|
r5 = value6;
|
|
continue reducibleLoop11;
|
|
}
|
|
break reducibleLoop11;
|
|
}
|
|
}
|
|
value7 = environment;
|
|
binding = env0_0;
|
|
setTimeout = global.setTimeout;
|
|
binding.rollTimer = setTimeout(_fun120366, ROLL_DURATION_MS);
|
|
break reducibleJoin13;
|
|
}
|
|
}
|
|
|
|
function _fun120368() { // fn#120368, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:1717, offset: 0x0252947c, size: 29 bytes, params: 1, frame: 9
|
|
const binding = env0_0;
|
|
binding.postRollDismissTimer = null;
|
|
binding.dismiss();
|
|
}
|
|
|
|
function _fun120371(a0) { // fn#120371, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:2235, offset: 0x025296bd, size: 38 bytes, params: 2, frame: 11
|
|
return ':game_die: ' + a0.toString();
|
|
}
|
|
|
|
function _fun120373() { // fn#120373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:2494, offset: 0x0252972a, size: 41 bytes, params: 1, frame: 11
|
|
env0_0.collapseTimer = null;
|
|
DiceRollStore.setState(INITIAL_STATE);
|
|
}
|
|
|
|
function _fun120366() { // fn#120366, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15896:1484, offset: 0x025293df, size: 53 bytes, params: 1, frame: 17
|
|
const binding = env1_0;
|
|
binding.rollTimer = null;
|
|
binding.finishRoll(channelId, env0_1, env0_2, env0_3);
|
|
}
|
|
|