Files
discord-decomp/_bundle/Module424.js
T
2026-11-01 12:12:55 +02:00

427 lines
15 KiB
JavaScript

// Metro module 424 (f425).
import _objectWithoutProperties from "./_objectWithoutProperties";
import { jsx } from "react/jsx-runtime";
import Module273 from "./Module273";
import Module68 from "./Module68";
import Position from "./Position";
import BoundingDimensions from "./BoundingDimensions";
import Module294 from "./Module294";
let touchState, c439_4, c439_5, c439_6, c439_7, c439_8, c439_9, c439_10, c439_11, c439_12, c439_13, c439_14, c439_15, c439_16, c439_17, c439_18;
jsx;
let c439_2 = (a0) => {};
touchState = "NOT_RESPONDER";
c439_4 = "RESPONDER_INACTIVE_PRESS_IN";
c439_5 = "RESPONDER_ACTIVE_PRESS_IN";
c439_6 = "RESPONDER_ACTIVE_LONG_PRESS_IN";
c439_7 = "ERROR";
const r30 = {
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
};
c439_8 = {
...r30,
RESPONDER_ACTIVE_PRESS_OUT: true,
RESPONDER_ACTIVE_PRESS_IN: true
};
c439_9 = {
...r30,
RESPONDER_INACTIVE_PRESS_IN: true,
RESPONDER_ACTIVE_PRESS_IN: true,
RESPONDER_ACTIVE_LONG_PRESS_IN: true
};
c439_10 = {
...r30,
RESPONDER_ACTIVE_LONG_PRESS_IN: true
};
c439_11 = "DELAY";
c439_12 = "RESPONDER_GRANT";
c439_13 = "RESPONDER_RELEASE";
c439_14 = "RESPONDER_TERMINATED";
c439_15 = "ENTER_PRESS_RECT";
c439_16 = "LEAVE_PRESS_RECT";
c439_17 = "LONG_PRESS_DETECTED";
c439_18 = {
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"
}
};
const Mixin = {
componentDidMount: function componentDidMount() {
Module273.isTV;
},
componentWillUnmount: function componentWillUnmount() {
if (this.touchableDelayTimeout) {
clearTimeout(this.touchableDelayTimeout);
}
if (this.longPressDelayTimeout) {
clearTimeout(this.longPressDelayTimeout);
}
if (this.pressOutDelayTimeout) {
clearTimeout(this.pressOutDelayTimeout);
}
},
touchableGetInitialState: function touchableGetInitialState() {
return {
touchable: {
touchState: void 0,
responderID: null
}
};
},
touchableHandleResponderTerminationRequest: function touchableHandleResponderTerminationRequest() {
return !this.props.rejectResponderTermination;
},
touchableHandleStartShouldSetResponder: function touchableHandleStartShouldSetResponder() {
return !this.props.disabled;
},
touchableLongPressCancelsPress: function touchableLongPressCancelsPress() {
return true;
},
touchableHandleResponderGrant: function touchableHandleResponderGrant(a0) {
const currentTarget = a0.currentTarget;
a0.persist();
if (this.pressOutDelayTimeout) {
clearTimeout(this.pressOutDelayTimeout);
}
this.pressOutDelayTimeout = null;
this.state.touchable.touchState = touchState;
this.state.touchable.responderID = currentTarget;
this._receiveSignal(c439_12, a0);
const touchableGetHighlightDelayMS = this.touchableGetHighlightDelayMS;
let r26 = 130;
const r28 = touchableGetHighlightDelayMS !== void 0 ? Math.max(this.touchableGetHighlightDelayMS(), 0) : 130;
if (!isNaN(r28)) {
r26 = r28;
}
if (r26 !== 0) {
this.touchableDelayTimeout = setTimeout(this._handleDelay.bind(this, a0), r26);
} else {
this._handleDelay(a0);
}
const touchableGetLongPressDelayMS = this.touchableGetLongPressDelayMS;
let r45 = 370;
const r46 = touchableGetLongPressDelayMS !== void 0 ? Math.max(this.touchableGetLongPressDelayMS(), 10) : 370;
if (!isNaN(r46)) {
r45 = r46;
}
this.longPressDelayTimeout = setTimeout(this._handleLongDelay.bind(this, a0), r45 + r26);
},
touchableHandleResponderRelease: function touchableHandleResponderRelease(a0) {
this.pressInLocation = null;
this._receiveSignal(c439_13, a0);
},
touchableHandleResponderTerminate: function touchableHandleResponderTerminate(a0) {
this.pressInLocation = null;
this._receiveSignal(c439_14, a0);
},
touchableHandleResponderMove: function touchableHandleResponderMove(a0) {
let r51;
L44: {
if (this.state.touchable.positionOnActivate) {
const positionOnActivate = this.state.touchable.positionOnActivate;
const dimensionsOnActivate = this.state.touchable.dimensionsOnActivate;
const r30 = this.touchableGetPressRectOffset ? this.touchableGetPressRectOffset() : {
left: 20,
right: 20,
top: 20,
bottom: 20
};
const { left, top, right, bottom } = r30;
const r10 = this.touchableGetHitSlop ? this.touchableGetHitSlop() : null;
let r7 = bottom;
let r12 = right;
let r13 = top;
let r14 = left;
if (r10) {
const r35 = left + (r10.left || 0);
const r37 = top + (r10.top || 0);
const r39 = right + (r10.right || 0);
r7 = bottom + (r10.bottom || 0);
r12 = r39;
r13 = r37;
r14 = r35;
}
let nativeEvent = a0.nativeEvent;
const { touches, changedTouches } = nativeEvent;
const r48 = touches && touches.length > 0;
const r49 = changedTouches && changedTouches.length > 0;
if (!r48 && r49) {
r51 = changedTouches[0];
} else {
if (r48) {
nativeEvent = touches[0];
}
r51 = nativeEvent;
}
const r52 = r51 ? r51.pageX : r51;
const r53 = r51 && r51.pageY;
if (this.pressInLocation && this._getDistanceBetweenPoints(r52, r53, this.pressInLocation.pageX, this.pressInLocation.pageY) > 10) {
this._cancelLongPressDelayTimeout();
}
if (r52 > positionOnActivate.left - r14 && r53 > positionOnActivate.top - r13 && r52 < positionOnActivate.left + dimensionsOnActivate.width + r12 && r53 < positionOnActivate.top + dimensionsOnActivate.height + r7) {
const touchState2 = this.state.touchable.touchState;
this._receiveSignal(c439_15, a0);
if (!(this.state.touchable.touchState === c439_4 && touchState2 !== c439_4)) {
break L44;
}
this._cancelLongPressDelayTimeout();
break L44;
}
this._cancelLongPressDelayTimeout();
this._receiveSignal(c439_16, a0);
}
}
},
touchableHandleFocus: function touchableHandleFocus(a0) {
if (this.props.onFocus) {
this.props.onFocus(a0);
}
},
touchableHandleBlur: function touchableHandleBlur(a0) {
if (this.props.onBlur) {
this.props.onBlur(a0);
}
},
_remeasureMetricsOnActivation: function _remeasureMetricsOnActivation() {
const responderID = this.state.touchable.responderID;
if (responderID != null) {
if (typeof responderID === "number") {
Module68.measure(responderID, this._handleQueryLayout);
} else {
responderID.measure(this._handleQueryLayout);
}
}
},
_handleQueryLayout: function _handleQueryLayout(a0, a1, a2, a3, a4, a5) {
if ((a0 ? a0 : a1) || a2 || a3 || a4 || a5) {
if (this.state.touchable.positionOnActivate) {
Position.release(this.state.touchable.positionOnActivate);
}
if (this.state.touchable.dimensionsOnActivate) {
BoundingDimensions.release(this.state.touchable.dimensionsOnActivate);
}
this.state.touchable.positionOnActivate = Position.getPooled(a4, a5);
this.state.touchable.dimensionsOnActivate = BoundingDimensions.getPooled(a2, a3);
}
},
_handleDelay: function _handleDelay(a0) {
this.touchableDelayTimeout = null;
this._receiveSignal(c439_11, a0);
},
_handleLongDelay: function _handleLongDelay(a0) {
this.longPressDelayTimeout = null;
const touchState2 = this.state.touchable.touchState;
if (!(touchState2 !== c439_5 && touchState2 !== c439_6)) {
this._receiveSignal(c439_17, a0);
}
},
_receiveSignal: function _receiveSignal(a0, a1) {
const responderID = this.state.touchable.responderID;
const touchState2 = this.state.touchable.touchState;
const touchState3 = c439_18[touchState2] && c439_18[touchState2][a0];
if (!(!responderID && a0 === c439_13)) {
if (!touchState3) {
throw new Error(HermesInternal.concat.call("Unrecognized signal `" + a0 + "` or state `" + touchState2, "` for Touchable responder `", typeof this.state.touchable.responderID) === "number" ? this.state.touchable.responderID : "host component`");
}
if (touchState3 === c439_7) {
throw new Error(HermesInternal.concat.call("Touchable cannot transition from `" + touchState2 + "` to `" + a0, "` for responder `", typeof this.state.touchable.responderID) === "number" ? this.state.touchable.responderID : "<<host component>>`");
}
if (touchState2 !== touchState3) {
this._performSideEffectsForTransition(touchState2, touchState3, a0, a1);
this.state.touchable.touchState = touchState3;
}
}
},
_cancelLongPressDelayTimeout: function _cancelLongPressDelayTimeout() {
if (this.longPressDelayTimeout) {
clearTimeout(this.longPressDelayTimeout);
}
this.longPressDelayTimeout = null;
},
_isHighlight: function _isHighlight(a0) {
return a0 === c439_5 || a0 === c439_6;
},
_savePressInLocation: function _savePressInLocation({ nativeEvent }) {
let r15;
const { touches, changedTouches } = nativeEvent;
const r5 = touches && touches.length > 0;
const r13 = changedTouches && changedTouches.length > 0;
if (!r5 && r13) {
r15 = changedTouches[0];
} else {
if (r5) {
nativeEvent = touches[0];
}
r15 = nativeEvent;
}
this.pressInLocation = {
pageX: r15 ? r15.pageX : r15,
pageY: r15 ? r15.pageY : r15,
locationX: r15 ? r15.locationX : r15,
locationY: r15 && r15.locationY
};
},
_getDistanceBetweenPoints: function _getDistanceBetweenPoints(a0, a1, a2, a3) {
const r3 = a0 - a2;
const r6 = a1 - a3;
return Math.sqrt(r3 * r3 + r6 * r6);
},
_performSideEffectsForTransition: function _performSideEffectsForTransition(a0, a1, a2, a3) {
const r6 = this._isHighlight(a0);
let r5 = this._isHighlight(a1);
if (a2 === c439_14 || a2 === c439_13) {
this._cancelLongPressDelayTimeout();
}
let r19 = a0 === touchState && a1 === c439_4;
if (!r19) {
const r12 = c439_8[a0];
r19 = r12 ? !r12 : c439_8[a1];
}
if (r19) {
this._remeasureMetricsOnActivation();
}
if (c439_9[a0] && a2 === c439_17 && this.touchableHandleLongPress) {
this.touchableHandleLongPress(a3);
}
if (r5 && !r6) {
this._startHighlight(a3);
} else if (r5 ? !r5 : r6) {
this._endHighlight(a3);
}
if (c439_9[a0] && a2 === c439_13) {
const r38 = !this.props.onLongPress;
let r40 = c439_10[a0];
if (r40) {
const r1 = !r38;
r40 = r1 ? !this.touchableLongPressCancelsPress() : !r1;
}
const r44 = c439_10[a0];
if ((r44 ? r40 : !r44) && this.touchableHandlePress) {
if (!r5) {
r5 = r6;
}
if (!r5) {
this._startHighlight(a3);
this._endHighlight(a3);
}
if (!this.props.touchSoundDisabled) {
Module294.playTouchSound();
}
this.touchableHandlePress(a3);
}
}
if (this.touchableDelayTimeout) {
clearTimeout(this.touchableDelayTimeout);
}
this.touchableDelayTimeout = null;
},
_startHighlight: function _startHighlight(a0) {
this._savePressInLocation(a0);
if (this.touchableHandleActivePressIn) {
this.touchableHandleActivePressIn(a0);
}
},
_endHighlight: function _endHighlight(a0) {
let c12322_0;
L5: {
c12322_0 = a0;
if (this.touchableHandleActivePressOut) {
if (this.touchableGetPressOutDelayMS && this.touchableGetPressOutDelayMS()) {
this.pressOutDelayTimeout = setTimeout(() => {
this.touchableHandleActivePressOut(c12322_0);
}, this.touchableGetPressOutDelayMS());
break L5;
}
this.touchableHandleActivePressOut(a0);
}
}
},
withoutDefaultFocusAndBlur: {}
};
Mixin.touchableHandleFocus;
Mixin.touchableHandleBlur;
Mixin.withoutDefaultFocusAndBlur = _objectWithoutProperties(Mixin, ["touchableHandleFocus", "touchableHandleBlur"]);
export default {
Mixin,
renderDebugView: (a0) => {
a0.color;
a0.hitSlop;
return null;
}
};