Files
discord-decomp/sources/by-id/module-00417.js
T
2026-07-28 01:06:53 +03:00

472 lines
23 KiB
JavaScript

/* Metro module 417; source: unknown; dependencies: [29, 31, 33, 262, 46, 418, 420, 285] */
import ObjectWithoutProperties from './module-00029-ObjectWithoutProperties.js'; /* Metro dependency 29 */
import * as ReactModule from './module-00031-React.js'; /* Metro dependency 31 */
import * as JsxRuntimeModule from './module-00033-JsxRuntime.js'; /* Metro dependency 33 */
function _fun5854(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#5854, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:458:6, offset: 0x00ce7e40, size: 650 bytes, params: 8, frame: 21
let Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ObjectWithoutProperties;
ReactModule;
(JsxRuntimeModule).jsx;
const extractSingleTouch = function(a0) {
var r2;
var r0;
var value = a0;
var property = value.touches;
var changedTouches = value.changedTouches;
r2 = property && property.length > 0;
r0 = changedTouches && changedTouches.length > 0;
r0 = r2 ? r2 ? property[0] : value : r0 ? changedTouches[0] : r2 ? property[0] : value;
return r0;
};
object = {'NOT_RESPONDER': false, 'RESPONDER_INACTIVE_PRESS_IN': false, 'RESPONDER_INACTIVE_PRESS_OUT': false,
'RESPONDER_ACTIVE_PRESS_IN': false, 'RESPONDER_ACTIVE_PRESS_OUT': false,
'RESPONDER_ACTIVE_LONG_PRESS_IN': false, 'RESPONDER_ACTIVE_LONG_PRESS_OUT': false, 'ERROR': false};
Object = global.Object;
const env0_3 = Object.assign({}, object, {'RESPONDER_ACTIVE_PRESS_OUT': true, 'RESPONDER_ACTIVE_PRESS_IN': true});
Object = global.Object;
const env0_4 = Object.assign({}, object, {'RESPONDER_INACTIVE_PRESS_IN': true, 'RESPONDER_ACTIVE_PRESS_IN': true,
'RESPONDER_ACTIVE_LONG_PRESS_IN': true});
Object = global.Object;
const env0_5 = Object.assign({}, object, {RESPONDER_ACTIVE_LONG_PRESS_IN: true});
object = {NOT_RESPONDER: {'DELAY': 'ERROR', 'RESPONDER_GRANT': 'RESPONDER_INACTIVE_PRESS_IN',
'RESPONDER_RELEASE': 'ERROR', 'RESPONDER_TERMINATED': 'ERROR', 'ENTER_PRESS_RECT': 'ERROR',
'LEAVE_PRESS_RECT': 'ERROR', 'LONG_PRESS_DETECTED': 'ERROR'},
RESPONDER_INACTIVE_PRESS_IN: {'DELAY': 'RESPONDER_ACTIVE_PRESS_IN', 'RESPONDER_GRANT': 'ERROR',
'RESPONDER_RELEASE': 'NOT_RESPONDER', 'RESPONDER_TERMINATED': 'NOT_RESPONDER',
'ENTER_PRESS_RECT': 'RESPONDER_INACTIVE_PRESS_IN', 'LEAVE_PRESS_RECT': 'RESPONDER_INACTIVE_PRESS_OUT',
'LONG_PRESS_DETECTED': 'ERROR'}, RESPONDER_INACTIVE_PRESS_OUT: {'DELAY': 'RESPONDER_ACTIVE_PRESS_OUT',
'RESPONDER_GRANT': 'ERROR', 'RESPONDER_RELEASE': 'NOT_RESPONDER', 'RESPONDER_TERMINATED': 'NOT_RESPONDER',
'ENTER_PRESS_RECT': 'RESPONDER_INACTIVE_PRESS_IN', 'LEAVE_PRESS_RECT': 'RESPONDER_INACTIVE_PRESS_OUT',
'LONG_PRESS_DETECTED': 'ERROR'}, RESPONDER_ACTIVE_PRESS_IN: {'DELAY': 'ERROR', 'RESPONDER_GRANT': 'ERROR',
'RESPONDER_RELEASE': 'NOT_RESPONDER', 'RESPONDER_TERMINATED': 'NOT_RESPONDER',
'ENTER_PRESS_RECT': 'RESPONDER_ACTIVE_PRESS_IN', 'LEAVE_PRESS_RECT': 'RESPONDER_ACTIVE_PRESS_OUT',
'LONG_PRESS_DETECTED': 'RESPONDER_ACTIVE_LONG_PRESS_IN'}, RESPONDER_ACTIVE_PRESS_OUT: {'DELAY': 'ERROR',
'RESPONDER_GRANT': 'ERROR', 'RESPONDER_RELEASE': 'NOT_RESPONDER', 'RESPONDER_TERMINATED': 'NOT_RESPONDER',
'ENTER_PRESS_RECT': 'RESPONDER_ACTIVE_PRESS_IN', 'LEAVE_PRESS_RECT': 'RESPONDER_ACTIVE_PRESS_OUT',
'LONG_PRESS_DETECTED': 'ERROR'}, RESPONDER_ACTIVE_LONG_PRESS_IN: {'DELAY': 'ERROR', 'RESPONDER_GRANT': 'ERROR',
'RESPONDER_RELEASE': 'NOT_RESPONDER', 'RESPONDER_TERMINATED': 'NOT_RESPONDER',
'ENTER_PRESS_RECT': 'RESPONDER_ACTIVE_LONG_PRESS_IN', 'LEAVE_PRESS_RECT': 'RESPONDER_ACTIVE_LONG_PRESS_OUT',
'LONG_PRESS_DETECTED': 'RESPONDER_ACTIVE_LONG_PRESS_IN'}, RESPONDER_ACTIVE_LONG_PRESS_OUT: {'DELAY': 'ERROR',
'RESPONDER_GRANT': 'ERROR', 'RESPONDER_RELEASE': 'NOT_RESPONDER', 'RESPONDER_TERMINATED': 'NOT_RESPONDER',
'ENTER_PRESS_RECT': 'RESPONDER_ACTIVE_LONG_PRESS_IN', 'LEAVE_PRESS_RECT': 'RESPONDER_ACTIVE_LONG_PRESS_OUT',
'LONG_PRESS_DETECTED': 'ERROR'}, error: {'DELAY': 'NOT_RESPONDER',
'RESPONDER_GRANT': 'RESPONDER_INACTIVE_PRESS_IN', 'RESPONDER_RELEASE': 'NOT_RESPONDER',
'RESPONDER_TERMINATED': 'NOT_RESPONDER', 'ENTER_PRESS_RECT': 'NOT_RESPONDER',
'LEAVE_PRESS_RECT': 'NOT_RESPONDER', 'LONG_PRESS_DETECTED': 'NOT_RESPONDER'}};
object = {componentDidMount: function() {
importDefault(dependencyMap[3]).isTV;
}, componentWillUnmount: function() {
if (this.touchableDelayTimeout) {
global.clearTimeout(this.touchableDelayTimeout);
}
if (this.longPressDelayTimeout) {
global.clearTimeout(this.longPressDelayTimeout);
}
if (this.pressOutDelayTimeout) {
global.clearTimeout(this.pressOutDelayTimeout);
}
}, touchableGetInitialState: function() {
return {touchable: {touchState: undefined, responderID: null}};
}, touchableHandleResponderTerminationRequest: function() {
return !this.props.rejectResponderTermination;
}, touchableHandleStartShouldSetResponder: function() {
return !this.props.disabled;
}, touchableLongPressCancelsPress: function() {
return true;
}, touchableHandleResponderGrant: touchableHandleResponderGrant, touchableHandleResponderRelease: function(a0) {
this.pressInLocation = null;
this._receiveSignal('RESPONDER_RELEASE', a0);
}, touchableHandleResponderTerminate: function(a0) {
this.pressInLocation = null;
this._receiveSignal('RESPONDER_TERMINATED', a0);
}, touchableHandleResponderMove: touchableHandleResponderMove, touchableHandleFocus: function(a0) {
if (this.props.onFocus) {
this.props.onFocus(a0);
}
}, touchableHandleBlur: function(a0) {
if (this.props.onBlur) {
this.props.onBlur(a0);
}
}, _remeasureMetricsOnActivation: _remeasureMetricsOnActivation, _handleQueryLayout: _handleQueryLayout,
_handleDelay: function(a0) {
this.touchableDelayTimeout = null;
this._receiveSignal('DELAY', a0);
}, _handleLongDelay: function(a0) {
this.longPressDelayTimeout = null;
var touchState = this.state.touchable.touchState;
if (!(touchState !== 'RESPONDER_ACTIVE_PRESS_IN' && touchState !== 'RESPONDER_ACTIVE_LONG_PRESS_IN')) {
this._receiveSignal('LONG_PRESS_DETECTED', a0);
}
}, _receiveSignal: _receiveSignal, _cancelLongPressDelayTimeout: function() {
if (this.longPressDelayTimeout) {
global.clearTimeout(this.longPressDelayTimeout);
}
this.longPressDelayTimeout = null;
}, _isHighlight: function(a0) {
return a0 === 'RESPONDER_ACTIVE_PRESS_IN' || a0 === 'RESPONDER_ACTIVE_LONG_PRESS_IN';
}, _savePressInLocation: _savePressInLocation, _getDistanceBetweenPoints: function(a0, a1, a2, a3) {
var value = a0 - a2;
var value2 = a1 - a3;
var Math = global.Math;
value *= value;
return Math.sqrt(value + value2 * value2);
}, _performSideEffectsForTransition: _performSideEffectsForTransition, _startHighlight: function(a0) {
this._savePressInLocation(a0);
if (this.touchableHandleActivePressIn) {
this.touchableHandleActivePressIn(a0);
}
}, _endHighlight: function(a0) {
var env0_0 = a0;
var env0_1 = this;
if (this.touchableHandleActivePressOut) {
if (this.touchableGetPressOutDelayMS) {
if (this.touchableGetPressOutDelayMS()) {
this.pressOutDelayTimeout = global.setTimeout(_fun5880, this.touchableGetPressOutDelayMS());
} else {
this.touchableHandleActivePressOut(a0);
}
} else {
this.touchableHandleActivePressOut(a0);
}
}
}, withoutDefaultFocusAndBlur: {}};
object.touchableHandleFocus;
object.touchableHandleBlur;
object.withoutDefaultFocusAndBlur = value(object, ['touchableHandleFocus', 'touchableHandleBlur']);
exports.default = {Mixin: object, renderDebugView: function(a0) {
a0.color;
a0.hitSlop;
return null;
}};
function touchableHandleResponderMove(a0) { // fn#5865, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:458:4135, offset: 0x00ce8372, size: 508 bytes, params: 2, frame: 26
var r2;
var left;
var top;
var right;
var bottom;
var r3;
var r8;
var r9;
var r10;
var r7;
var dimensionsOnActivate;
var value;
var left2;
var top2;
var right2;
var bottom2;
var touchableGetHitSlop;
var value3;
var value5;
var pageX;
var pressInLocation;
var _getDistanceBetweenPoints;
var touchState;
let state = this.state;
let touchable = state.touchable;
let positionOnActivate = touchable.positionOnActivate;
if (positionOnActivate) {
state = this.state;
touchable = state.touchable;
positionOnActivate = touchable.positionOnActivate;
state = this.state;
touchable = state.touchable;
dimensionsOnActivate = touchable.dimensionsOnActivate;
r2 = this.touchableGetPressRectOffset ? this.touchableGetPressRectOffset() : {'left': 20, 'right': 20,
'top': 20,
'bottom': 20};
left2 = r2.left;
top2 = r2.top;
right2 = r2.right;
bottom2 = r2.bottom;
touchableGetHitSlop = this.touchableGetHitSlop;
value = null;
r2 = touchableGetHitSlop ? this.touchableGetHitSlop() : value;
if (r2) {
left = r2.left;
left = !left ? 0 : left;
value = left2 + left;
top = r2.top;
top = !top ? 0 : top;
value3 = top2 + top;
right = r2.right;
right = !right ? 0 : right;
value5 = right2 + right;
bottom = r2.bottom;
bottom = !bottom ? 0 : bottom;
r3 = bottom2 + bottom;
r8 = value5;
r9 = value3;
r10 = value;
} else {
r3 = bottom2;
r8 = right2;
r9 = top2;
r10 = left2;
}
value = extractSingleTouch(a0.nativeEvent);
r7 = value && value.pageX;
r2 = value && value.pageY;
pressInLocation = this.pressInLocation;
if (pressInLocation) {
_getDistanceBetweenPoints = this._getDistanceBetweenPoints;
pressInLocation = this.pressInLocation;
pageX = pressInLocation.pageX;
pressInLocation = this.pressInLocation;
if (Reflect.apply(_getDistanceBetweenPoints, this, [r7, r2, pageX, pressInLocation.pageY]) > 10) {
this._cancelLongPressDelayTimeout();
}
}
left = positionOnActivate.left;
if (r7 > left - r10) {
if (r2 > positionOnActivate.top - r9) {
if (r7 < positionOnActivate.left + dimensionsOnActivate.width + r8) {
if (r2 < positionOnActivate.top + dimensionsOnActivate.height + r3) {
state = this.state;
touchable = state.touchable;
touchState = touchable.touchState;
this._receiveSignal('ENTER_PRESS_RECT', a0);
state = this.state;
touchable = state.touchable;
if (touchable.touchState === 'RESPONDER_INACTIVE_PRESS_IN' && touchState !== 'RESPONDER_INACTIVE_PRESS_IN') {
this._cancelLongPressDelayTimeout();
}
} else {
this._cancelLongPressDelayTimeout();
this._receiveSignal('LEAVE_PRESS_RECT', a0);
}
} else {
this._cancelLongPressDelayTimeout();
this._receiveSignal('LEAVE_PRESS_RECT', a0);
}
} else {
this._cancelLongPressDelayTimeout();
this._receiveSignal('LEAVE_PRESS_RECT', a0);
}
} else {
this._cancelLongPressDelayTimeout();
this._receiveSignal('LEAVE_PRESS_RECT', a0);
}
}
}
function _remeasureMetricsOnActivation() { // fn#5868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:458:5272, offset: 0x00ce85be, size: 103 bytes, params: 1, frame: 14
var value;
const responderID = this.state.touchable.responderID;
if (responderID != null) {
if (typeof responderID === 'number') {
value = importDefault(46) /* metro dependency 46 */;
value.measure(responderID, this._handleQueryLayout);
} else {
responderID.measure(this._handleQueryLayout);
}
}
}
function _handleQueryLayout(a0, a1, a2, a3, a4, a5) { // fn#5869, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:458:5480, offset: 0x00ce8625, size: 302 bytes, params: 7, frame: 20
var state;
var touchable;
let value = a0;
const value2 = a1;
const value3 = a2;
const value4 = a3;
const value5 = a4;
const value6 = a5;
let r1 = value || value2;
r1 = !r1 ? value3 : r1;
r1 = !r1 ? value4 : r1;
r1 = !r1 ? value5 : r1;
r1 = !r1 ? value6 : r1;
if (r1) {
state = this.state;
touchable = state.touchable;
if (touchable.positionOnActivate) {
value = importDefault(418) /* metro dependency 418 */;
value.release(this.state.touchable.positionOnActivate);
}
state = this.state;
touchable = state.touchable;
if (touchable.dimensionsOnActivate) {
value = importDefault(420) /* metro dependency 420 */;
value.release(this.state.touchable.dimensionsOnActivate);
}
state = this.state;
touchable = state.touchable;
value = importDefault(418) /* metro dependency 418 */;
touchable.positionOnActivate = value.getPooled(value5, value6);
state = this.state;
touchable = state.touchable;
value = importDefault(420) /* metro dependency 420 */;
touchable.dimensionsOnActivate = value.getPooled(value3, value4);
}
}
function _receiveSignal(a0, a1) { // fn#5872, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:458:6139, offset: 0x00ce87be, size: 388 bytes, params: 3, frame: 20
var Error;
let responderID = this.state.touchable.responderID;
const touchState = this.state.touchable.touchState;
var value;
const r2 = env0_6[touchState] && env0_6[touchState][a0];
if (responderID) {
if (r2) {
if (r2 === 'ERROR') {
Error = global.Error;
value = 'Touchable cannot transition from `' + touchState + '` to `' + a0;
responderID = this.state.touchable.responderID;
responderID = value + '` for responder `' + typeof responderID !== 'number' ? '<<host component>>`' : this.state.touchable.responderID;
throw new Error(responderID);
}
if (touchState !== r2) {
this._performSideEffectsForTransition(touchState, r2, a0, a1);
this.state.touchable.touchState = r2;
}
return undefined;
}
Error = global.Error;
value = 'Unrecognized signal `' + a0 + '` or state `' + touchState;
responderID = this.state.touchable.responderID;
responderID = value + '` for Touchable responder `' + typeof responderID !== 'number' ? 'host component`' : this.state.touchable.responderID;
throw new Error(responderID);
}
if (a0 === 'RESPONDER_RELEASE') {
return undefined;
}
if (r2) {
if (r2 === 'ERROR') {
Error = global.Error;
value = 'Touchable cannot transition from `' + touchState + '` to `' + a0;
responderID = this.state.touchable.responderID;
responderID = value + '` for responder `' + typeof responderID !== 'number' ? '<<host component>>`' : this.state.touchable.responderID;
throw new Error(responderID);
}
if (touchState !== r2) {
this._performSideEffectsForTransition(touchState, r2, a0, a1);
this.state.touchable.touchState = r2;
}
return undefined;
}
Error = global.Error;
value = 'Unrecognized signal `' + a0 + '` or state `' + touchState;
responderID = this.state.touchable.responderID;
responderID = value + '` for Touchable responder `' + typeof responderID !== 'number' ? 'host component`' : this.state.touchable.responderID;
throw new Error(responderID);
}
function _savePressInLocation({nativeEvent}) { // fn#5875, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:458:7011, offset: 0x00ce8987, size: 104 bytes, params: 2, frame: 15
const value = extractSingleTouch(nativeEvent);
this.pressInLocation = {pageX: value && value.pageX, pageY: value && value.pageY,
locationX: value && value.locationX, locationY: value && value.locationY};
}
function _performSideEffectsForTransition(a0, a1, a2, a3) { // fn#5877, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:458:7337, offset: 0x00ce8a24, size: 450 bytes, params: 5, frame: 19
var r6;
var onLongPress;
const value = this._isHighlight(a0);
const value2 = this._isHighlight(a1);
if (a2 === 'RESPONDER_TERMINATED' || a2 === 'RESPONDER_RELEASE') {
this._cancelLongPressDelayTimeout();
}
let r5 = a0 === 'NOT_RESPONDER' && a1 === 'RESPONDER_INACTIVE_PRESS_IN';
let property = env0_3[a0];
r5 = !r5 ? !property && env0_3[a1] : r5;
if (r5) {
this._remeasureMetricsOnActivation();
}
if (env0_4[a0] && a2 === 'LONG_PRESS_DETECTED' && this.touchableHandleLongPress) {
this.touchableHandleLongPress(a3);
}
if (value2) {
if (value) {
if (!value2 && value) {
this._endHighlight(a3);
}
} else {
this._startHighlight(a3);
}
} else if (!value2 && value) {
this._endHighlight(a3);
}
if (env0_4[a0]) {
if (a2 === 'RESPONDER_RELEASE') {
onLongPress = this.props.onLongPress;
property = env0_5[a0];
r6 = property && (onLongPress ? !this.touchableLongPressCancelsPress() : !!!onLongPress);
property = env0_5[a0];
r5 = property ? r6 : !property;
r5 = r5 && this.touchableHandlePress;
if (r5) {
if (!(value2 || value)) {
this._startHighlight(a3);
this._endHighlight(a3);
}
if (!this.props.touchSoundDisabled) {
(importDefault(285) /* metro dependency 285 */).playTouchSound();
}
this.touchableHandlePress(a3);
}
}
}
if (this.touchableDelayTimeout) {
global.clearTimeout(this.touchableDelayTimeout);
}
this.touchableDelayTimeout = null;
}
function _endHighlight(a0) { // fn#5879, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:458:8246, offset: 0x00ce8c0f, size: 101 bytes, params: 2, frame: 14
const env0_0 = a0;
if (this.touchableHandleActivePressOut) {
if (this.touchableGetPressOutDelayMS) {
if (this.touchableGetPressOutDelayMS()) {
this.pressOutDelayTimeout = global.setTimeout(_fun5880, this.touchableGetPressOutDelayMS());
} else {
this.touchableHandleActivePressOut(a0);
}
} else {
this.touchableHandleActivePressOut(a0);
}
}
function _fun5880() { // fn#5880, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:458:8427, offset: 0x00ce8c74, size: 26 bytes, params: 1, frame: 11
env0_1.touchableHandleActivePressOut(env0_0);
}
}
}
function touchableHandleResponderGrant(a0) { // fn#5862, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:458:3163, offset: 0x00ce81d7, size: 343 bytes, params: 2, frame: 20
var _handleDelay;
var setTimeout;
const currentTarget = a0.currentTarget;
a0.persist();
if (this.pressOutDelayTimeout) {
global.clearTimeout(this.pressOutDelayTimeout);
}
this.pressOutDelayTimeout = null;
this.state.touchable.touchState = 'NOT_RESPONDER';
this.state.touchable.responderID = currentTarget;
this._receiveSignal('RESPONDER_GRANT', a0);
const touchableGetHighlightDelayMS = this.touchableGetHighlightDelayMS;
let value = 130;
const r1 = touchableGetHighlightDelayMS === undefined ? value : global.Math.max(this.touchableGetHighlightDelayMS(),
0);
const r5 = global.isNaN(r1) ? value : r1;
if (r5 !== 0) {
setTimeout = global.setTimeout;
_handleDelay = this._handleDelay;
this.touchableDelayTimeout = setTimeout(_handleDelay.bind(this, a0), r5);
} else {
this._handleDelay(a0);
}
const touchableGetLongPressDelayMS = this.touchableGetLongPressDelayMS;
value = 370;
const r4 = touchableGetLongPressDelayMS === undefined ? value : global.Math.max(this.touchableGetLongPressDelayMS(),
10);
this.longPressDelayTimeout = global.setTimeout(this._handleLongDelay.bind(this, a0),
(global.isNaN(r4) ? value : r4) + r5);
}
global.__d(_fun5854, 417, [29, 31, 33, 262, 46, 418, 420,
285]) /* metro module 417, dependencies: [29, 31, 33, 262, 46, 418, 420, 285] */;